]> git.proxmox.com Git - rustc.git/blob - src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs-error.rs
New upstream version 1.48.0~beta.8+dfsg1
[rustc.git] / src / test / ui / feature-gate / issue-43106-gating-of-builtin-attrs-error.rs
1 // This is testing whether various builtin attributes signals an
2 // error or warning when put in "weird" places.
3 //
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)
7
8 // ignore-tidy-linelength
9
10 // Crate-level is accepted, though it is almost certainly unused?
11 #![inline]
12
13 #[inline]
14 //~^ ERROR attribute should be applied to function or closure
15 mod inline {
16 //~^ NOTE not a function or closure
17
18 mod inner { #![inline] }
19 //~^ ERROR attribute should be applied to function or closure
20 //~| NOTE not a function or closure
21
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>
27
28 #[inline] struct S;
29 //~^ ERROR attribute should be applied to function or closure
30 //~| NOTE not a function or closure
31
32 #[inline] type T = S;
33 //~^ ERROR attribute should be applied to function or closure
34 //~| NOTE not a function or closure
35
36 #[inline] impl S { }
37 //~^ ERROR attribute should be applied to function or closure
38 //~| NOTE not a function or closure
39 }
40
41 #[no_link]
42 //~^ ERROR attribute should be applied to an `extern crate` item
43 mod no_link {
44 //~^ NOTE not an `extern crate` item
45
46 mod inner { #![no_link] }
47 //~^ ERROR attribute should be applied to an `extern crate` item
48 //~| NOTE not an `extern crate` item
49
50 #[no_link] fn f() { }
51 //~^ ERROR attribute should be applied to an `extern crate` item
52 //~| NOTE not an `extern crate` item
53
54 #[no_link] struct S;
55 //~^ ERROR attribute should be applied to an `extern crate` item
56 //~| NOTE not an `extern crate` item
57
58 #[no_link]type T = S;
59 //~^ ERROR attribute should be applied to an `extern crate` item
60 //~| NOTE not an `extern crate` item
61
62 #[no_link] impl S { }
63 //~^ ERROR attribute should be applied to an `extern crate` item
64 //~| NOTE not an `extern crate` item
65 }
66
67 #[export_name = "2200"]
68 //~^ ERROR attribute should be applied to a function or static
69 mod export_name {
70 //~^ NOTE not a function or static
71
72 mod inner { #![export_name="2200"] }
73 //~^ ERROR attribute should be applied to a function or static
74 //~| NOTE not a function or static
75
76 #[export_name = "2200"] fn f() { }
77
78 #[export_name = "2200"] struct S;
79 //~^ ERROR attribute should be applied to a function or static
80 //~| NOTE not a function or static
81
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
85
86 #[export_name = "2200"] impl S { }
87 //~^ ERROR attribute should be applied to a function or static
88 //~| NOTE not a function or static
89 }
90
91 fn main() {}