1 // This is testing whether various builtin attributes signals an
2 // error or warning when put in "weird" places.
4 // (This file sits on its own because it actually signals an error,
5 // which would mess up the treatment of other cases in
6 // issue-43106-gating-of-builtin-attrs.rs)
8 // ignore-tidy-linelength
10 // Crate-level is accepted, though it is almost certainly unused?
14 //~^ ERROR attribute should be applied to function or closure
16 //~^ NOTE not a function or closure
18 mod inner { #![inline] }
19 //~^ ERROR attribute should be applied to function or closure
20 //~| NOTE not a function or closure
22 #[inline = "2100"] fn f() { }
23 //~^ ERROR attribute must be of the form
24 //~| WARN this was previously accepted
25 //~| NOTE #[deny(ill_formed_attribute_input)]` on by default
26 //~| NOTE for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
29 //~^ ERROR attribute should be applied to function or closure
30 //~| NOTE not a function or closure
33 //~^ ERROR attribute should be applied to function or closure
34 //~| NOTE not a function or closure
37 //~^ ERROR attribute should be applied to function or closure
38 //~| NOTE not a function or closure
42 //~^ ERROR attribute should be applied to an `extern crate` item
44 //~^ NOTE not an `extern crate` item
46 mod inner { #![no_link] }
47 //~^ ERROR attribute should be applied to an `extern crate` item
48 //~| NOTE not an `extern crate` item
51 //~^ ERROR attribute should be applied to an `extern crate` item
52 //~| NOTE not an `extern crate` item
55 //~^ ERROR attribute should be applied to an `extern crate` item
56 //~| NOTE not an `extern crate` item
59 //~^ ERROR attribute should be applied to an `extern crate` item
60 //~| NOTE not an `extern crate` item
63 //~^ ERROR attribute should be applied to an `extern crate` item
64 //~| NOTE not an `extern crate` item
67 #[export_name = "2200"]
68 //~^ ERROR attribute should be applied to a function or static
70 //~^ NOTE not a function or static
72 mod inner { #![export_name="2200"] }
73 //~^ ERROR attribute should be applied to a function or static
74 //~| NOTE not a function or static
76 #[export_name = "2200"] fn f() { }
78 #[export_name = "2200"] struct S;
79 //~^ ERROR attribute should be applied to a function or static
80 //~| NOTE not a function or static
82 #[export_name = "2200"] type T = S;
83 //~^ ERROR attribute should be applied to a function or static
84 //~| NOTE not a function or static
86 #[export_name = "2200"] impl S { }
87 //~^ ERROR attribute should be applied to a function or static
88 //~| NOTE not a function or static