]> git.lizzy.rs Git - rust.git/commitdiff
Fix error[E0518] not displayed for #[inline] on structs inside fns
authornxnfufunezn <nxnfufunezn@gmail.com>
Fri, 19 Feb 2016 16:57:50 +0000 (22:27 +0530)
committernxnfufunezn <nxnfufunezn@gmail.com>
Fri, 19 Feb 2016 18:19:11 +0000 (23:49 +0530)
src/librustc/front/check_attr.rs
src/test/compile-fail/issue-31769.rs [new file with mode: 0644]

index cfd9d5bdaa75d11be74b88e9e209a9aab7b7a4b3..085acc198d16adcdbccd2e1d94ff24b0bd75dc19 100644 (file)
@@ -101,6 +101,7 @@ fn visit_item(&mut self, item: &ast::Item) {
         for attr in &item.attrs {
             self.check_attribute(attr, target);
         }
+        visit::walk_item(self, item);
     }
 }
 
diff --git a/src/test/compile-fail/issue-31769.rs b/src/test/compile-fail/issue-31769.rs
new file mode 100644 (file)
index 0000000..4b5df7e
--- /dev/null
@@ -0,0 +1,14 @@
+// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    #[inline] struct Foo;  //~ ERROR attribute should be applied to function
+    #[repr(C)] fn foo() {} //~ ERROR attribute should be applied to struct or enum
+}