]> git.lizzy.rs Git - rust.git/blob - src/test/ui/rfc-2565-param-attrs/param-attrs-builtin-attrs.rs
Auto merge of #62339 - pnkfelix:issue-61188-use-visitor-for-structural-match-check...
[rust.git] / src / test / ui / rfc-2565-param-attrs / param-attrs-builtin-attrs.rs
1 #![feature(param_attrs)]
2
3 extern "C" {
4     fn ffi(
5         /// Foo
6         //~^ ERROR documentation comments cannot be applied to function
7         #[test] a: i32,
8         //~^ ERROR The attribute `test` is currently unknown to the compiler and may have
9         /// Bar
10         //~^ ERROR documentation comments cannot be applied to function
11         #[must_use]
12         //~^ ERROR allow, cfg, cfg_attr, deny, forbid, and warn are the only allowed built-in
13         /// Baz
14         //~^ ERROR documentation comments cannot be applied to function
15         #[no_mangle] b: i32,
16         //~^ ERROR allow, cfg, cfg_attr, deny, forbid, and warn are the only allowed built-in
17     );
18 }
19
20 type FnType = fn(
21     /// Foo
22     //~^ ERROR documentation comments cannot be applied to function
23     #[test] a: u32,
24     //~^ ERROR The attribute `test` is currently unknown to the compiler and may have
25     /// Bar
26     //~^ ERROR documentation comments cannot be applied to function
27     #[must_use]
28     //~^ ERROR allow, cfg, cfg_attr, deny, forbid, and warn are the only allowed built-in
29     /// Baz
30     //~^ ERROR documentation comments cannot be applied to function
31     #[no_mangle] b: i32,
32     //~^ ERROR allow, cfg, cfg_attr, deny, forbid, and warn are the only allowed built-in
33 );
34
35 pub fn foo(
36     /// Foo
37     //~^ ERROR documentation comments cannot be applied to function
38     #[test] a: u32,
39     //~^ ERROR The attribute `test` is currently unknown to the compiler and may have
40     /// Bar
41     //~^ ERROR documentation comments cannot be applied to function
42     #[must_use]
43     //~^ ERROR allow, cfg, cfg_attr, deny, forbid, and warn are the only allowed built-in
44     /// Baz
45     //~^ ERROR documentation comments cannot be applied to function
46     #[no_mangle] b: i32,
47     //~^ ERROR allow, cfg, cfg_attr, deny, forbid, and warn are the only allowed built-in
48 ) {}
49
50 struct SelfStruct {}
51 impl SelfStruct {
52     fn foo(
53         /// Foo
54         //~^ ERROR documentation comments cannot be applied to function
55         self,
56         /// Bar
57         //~^ ERROR documentation comments cannot be applied to function
58         #[test] a: i32,
59         //~^ ERROR The attribute `test` is currently unknown to the compiler and may have
60         /// Baz
61         //~^ ERROR documentation comments cannot be applied to function
62         #[must_use]
63         //~^ ERROR allow, cfg, cfg_attr, deny, forbid, and warn are the only allowed built-in
64         /// Qux
65         //~^ ERROR documentation comments cannot be applied to function
66         #[no_mangle] b: i32,
67         //~^ ERROR allow, cfg, cfg_attr, deny, forbid, and warn are the only allowed built-in
68     ) {}
69 }
70
71 struct RefStruct {}
72 impl RefStruct {
73     fn foo(
74         /// Foo
75         //~^ ERROR documentation comments cannot be applied to function
76         &self,
77         /// Bar
78         //~^ ERROR documentation comments cannot be applied to function
79         #[test] a: i32,
80         //~^ ERROR The attribute `test` is currently unknown to the compiler and may have
81         /// Baz
82         //~^ ERROR documentation comments cannot be applied to function
83         #[must_use]
84         //~^ ERROR allow, cfg, cfg_attr, deny, forbid, and warn are the only allowed built-in
85         /// Qux
86         //~^ ERROR documentation comments cannot be applied to function
87         #[no_mangle] b: i32,
88         //~^ ERROR allow, cfg, cfg_attr, deny, forbid, and warn are the only allowed built-in
89     ) {}
90 }
91 trait RefTrait {
92     fn foo(
93         /// Foo
94         //~^ ERROR documentation comments cannot be applied to function
95         &self,
96         /// Bar
97         //~^ ERROR documentation comments cannot be applied to function
98         #[test] a: i32,
99         //~^ ERROR The attribute `test` is currently unknown to the compiler and may have
100         /// Baz
101         //~^ ERROR documentation comments cannot be applied to function
102         #[must_use]
103         //~^ ERROR allow, cfg, cfg_attr, deny, forbid, and warn are the only allowed built-in
104         /// Qux
105         //~^ ERROR documentation comments cannot be applied to function
106         #[no_mangle] b: i32,
107         //~^ ERROR allow, cfg, cfg_attr, deny, forbid, and warn are the only allowed built-in
108     ) {}
109 }
110 impl RefTrait for RefStruct {
111     fn foo(
112         /// Foo
113         //~^ ERROR documentation comments cannot be applied to function
114         &self,
115         /// Bar
116         //~^ ERROR documentation comments cannot be applied to function
117         #[test] a: i32,
118         //~^ ERROR The attribute `test` is currently unknown to the compiler and may have
119         /// Baz
120         //~^ ERROR documentation comments cannot be applied to function
121         #[must_use]
122         //~^ ERROR allow, cfg, cfg_attr, deny, forbid, and warn are the only allowed built-in
123         /// Qux
124         //~^ ERROR documentation comments cannot be applied to function
125         #[no_mangle] b: i32,
126         //~^ ERROR allow, cfg, cfg_attr, deny, forbid, and warn are the only allowed built-in
127     ) {}
128 }
129
130 fn main() {
131     let _ = |
132         /// Foo
133         //~^ ERROR documentation comments cannot be applied to function
134         #[test] a: u32,
135         //~^ ERROR The attribute `test` is currently unknown to the compiler and may have
136         /// Bar
137         //~^ ERROR documentation comments cannot be applied to function
138         #[must_use]
139         //~^ ERROR allow, cfg, cfg_attr, deny, forbid, and warn are the only allowed built-in
140         /// Baz
141         //~^ ERROR documentation comments cannot be applied to function
142         #[no_mangle] b: i32
143         //~^ ERROR allow, cfg, cfg_attr, deny, forbid, and warn are the only allowed built-in
144     | {};
145 }