Skip to content

Commit 70f4b54

Browse files
Add attr-on-mac-call test
1 parent 64646df commit 70f4b54

2 files changed

Lines changed: 35 additions & 24 deletions

File tree

tests/ui/attributes/attr-on-mac-call.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
//@ check-pass
1+
//@ check-fail
22
// Regression test for https://github.com/rust-lang/rust/issues/145779
33
#![warn(unused_attributes)]
4+
#![feature(sanitize)]
45

56
fn main() {
67
#[export_name = "x"]
@@ -69,5 +70,7 @@ fn main() {
6970
#[should_panic]
7071
//~^ WARN attribute cannot be used on macro calls
7172
//~| WARN previously accepted
73+
#[sanitize(address = "off")]
74+
//~^ ERROR attribute cannot be used on macro calls
7275
unreachable!();
7376
}

tests/ui/attributes/attr-on-mac-call.stderr

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1+
error: `#[sanitize]` attribute cannot be used on macro calls
2+
--> $DIR/attr-on-mac-call.rs:73:5
3+
|
4+
LL | #[sanitize(address = "off")]
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= help: `#[sanitize]` can be applied to crates, functions, impl blocks, modules, and statics
8+
19
warning: `#[export_name]` attribute cannot be used on macro calls
2-
--> $DIR/attr-on-mac-call.rs:6:5
10+
--> $DIR/attr-on-mac-call.rs:7:5
311
|
412
LL | #[export_name = "x"]
513
| ^^^^^^^^^^^^^^^^^^^^
@@ -13,7 +21,7 @@ LL | #![warn(unused_attributes)]
1321
| ^^^^^^^^^^^^^^^^^
1422

1523
warning: `#[naked]` attribute cannot be used on macro calls
16-
--> $DIR/attr-on-mac-call.rs:9:5
24+
--> $DIR/attr-on-mac-call.rs:10:5
1725
|
1826
LL | #[unsafe(naked)]
1927
| ^^^^^^^^^^^^^^^^
@@ -22,7 +30,7 @@ LL | #[unsafe(naked)]
2230
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
2331

2432
warning: `#[track_caller]` attribute cannot be used on macro calls
25-
--> $DIR/attr-on-mac-call.rs:12:5
33+
--> $DIR/attr-on-mac-call.rs:13:5
2634
|
2735
LL | #[track_caller]
2836
| ^^^^^^^^^^^^^^^
@@ -31,7 +39,7 @@ LL | #[track_caller]
3139
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
3240

3341
warning: `#[used]` attribute cannot be used on macro calls
34-
--> $DIR/attr-on-mac-call.rs:15:5
42+
--> $DIR/attr-on-mac-call.rs:16:5
3543
|
3644
LL | #[used]
3745
| ^^^^^^^
@@ -40,7 +48,7 @@ LL | #[used]
4048
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
4149

4250
warning: `#[target_feature]` attribute cannot be used on macro calls
43-
--> $DIR/attr-on-mac-call.rs:18:5
51+
--> $DIR/attr-on-mac-call.rs:19:5
4452
|
4553
LL | #[target_feature(enable = "x")]
4654
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -49,7 +57,7 @@ LL | #[target_feature(enable = "x")]
4957
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
5058

5159
warning: `#[deprecated]` attribute cannot be used on macro calls
52-
--> $DIR/attr-on-mac-call.rs:21:5
60+
--> $DIR/attr-on-mac-call.rs:22:5
5361
|
5462
LL | #[deprecated]
5563
| ^^^^^^^^^^^^^
@@ -58,7 +66,7 @@ LL | #[deprecated]
5866
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
5967

6068
warning: `#[inline]` attribute cannot be used on macro calls
61-
--> $DIR/attr-on-mac-call.rs:24:5
69+
--> $DIR/attr-on-mac-call.rs:25:5
6270
|
6371
LL | #[inline]
6472
| ^^^^^^^^^
@@ -67,7 +75,7 @@ LL | #[inline]
6775
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
6876

6977
warning: `#[link_name]` attribute cannot be used on macro calls
70-
--> $DIR/attr-on-mac-call.rs:27:5
78+
--> $DIR/attr-on-mac-call.rs:28:5
7179
|
7280
LL | #[link_name = "x"]
7381
| ^^^^^^^^^^^^^^^^^^
@@ -76,7 +84,7 @@ LL | #[link_name = "x"]
7684
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
7785

7886
warning: `#[link_section]` attribute cannot be used on macro calls
79-
--> $DIR/attr-on-mac-call.rs:30:5
87+
--> $DIR/attr-on-mac-call.rs:31:5
8088
|
8189
LL | #[link_section = "__TEXT,__text"]
8290
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -85,7 +93,7 @@ LL | #[link_section = "__TEXT,__text"]
8593
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
8694

8795
warning: `#[link_ordinal]` attribute cannot be used on macro calls
88-
--> $DIR/attr-on-mac-call.rs:33:5
96+
--> $DIR/attr-on-mac-call.rs:34:5
8997
|
9098
LL | #[link_ordinal(42)]
9199
| ^^^^^^^^^^^^^^^^^^^
@@ -94,7 +102,7 @@ LL | #[link_ordinal(42)]
94102
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
95103

96104
warning: `#[non_exhaustive]` attribute cannot be used on macro calls
97-
--> $DIR/attr-on-mac-call.rs:36:5
105+
--> $DIR/attr-on-mac-call.rs:37:5
98106
|
99107
LL | #[non_exhaustive]
100108
| ^^^^^^^^^^^^^^^^^
@@ -103,7 +111,7 @@ LL | #[non_exhaustive]
103111
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
104112

105113
warning: `#[proc_macro]` attribute cannot be used on macro calls
106-
--> $DIR/attr-on-mac-call.rs:39:5
114+
--> $DIR/attr-on-mac-call.rs:40:5
107115
|
108116
LL | #[proc_macro]
109117
| ^^^^^^^^^^^^^
@@ -112,7 +120,7 @@ LL | #[proc_macro]
112120
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
113121

114122
warning: `#[cold]` attribute cannot be used on macro calls
115-
--> $DIR/attr-on-mac-call.rs:42:5
123+
--> $DIR/attr-on-mac-call.rs:43:5
116124
|
117125
LL | #[cold]
118126
| ^^^^^^^
@@ -121,7 +129,7 @@ LL | #[cold]
121129
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
122130

123131
warning: `#[no_mangle]` attribute cannot be used on macro calls
124-
--> $DIR/attr-on-mac-call.rs:45:5
132+
--> $DIR/attr-on-mac-call.rs:46:5
125133
|
126134
LL | #[no_mangle]
127135
| ^^^^^^^^^^^^
@@ -130,7 +138,7 @@ LL | #[no_mangle]
130138
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
131139

132140
warning: `#[deprecated]` attribute cannot be used on macro calls
133-
--> $DIR/attr-on-mac-call.rs:48:5
141+
--> $DIR/attr-on-mac-call.rs:49:5
134142
|
135143
LL | #[deprecated]
136144
| ^^^^^^^^^^^^^
@@ -139,7 +147,7 @@ LL | #[deprecated]
139147
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
140148

141149
warning: `#[automatically_derived]` attribute cannot be used on macro calls
142-
--> $DIR/attr-on-mac-call.rs:51:5
150+
--> $DIR/attr-on-mac-call.rs:52:5
143151
|
144152
LL | #[automatically_derived]
145153
| ^^^^^^^^^^^^^^^^^^^^^^^^
@@ -148,7 +156,7 @@ LL | #[automatically_derived]
148156
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
149157

150158
warning: `#[macro_use]` attribute cannot be used on macro calls
151-
--> $DIR/attr-on-mac-call.rs:54:5
159+
--> $DIR/attr-on-mac-call.rs:55:5
152160
|
153161
LL | #[macro_use]
154162
| ^^^^^^^^^^^^
@@ -157,7 +165,7 @@ LL | #[macro_use]
157165
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
158166

159167
warning: `#[must_use]` attribute cannot be used on macro calls
160-
--> $DIR/attr-on-mac-call.rs:57:5
168+
--> $DIR/attr-on-mac-call.rs:58:5
161169
|
162170
LL | #[must_use]
163171
| ^^^^^^^^^^^
@@ -166,7 +174,7 @@ LL | #[must_use]
166174
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
167175

168176
warning: `#[no_implicit_prelude]` attribute cannot be used on macro calls
169-
--> $DIR/attr-on-mac-call.rs:60:5
177+
--> $DIR/attr-on-mac-call.rs:61:5
170178
|
171179
LL | #[no_implicit_prelude]
172180
| ^^^^^^^^^^^^^^^^^^^^^^
@@ -175,7 +183,7 @@ LL | #[no_implicit_prelude]
175183
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
176184

177185
warning: `#[path]` attribute cannot be used on macro calls
178-
--> $DIR/attr-on-mac-call.rs:63:5
186+
--> $DIR/attr-on-mac-call.rs:64:5
179187
|
180188
LL | #[path = ""]
181189
| ^^^^^^^^^^^^
@@ -184,7 +192,7 @@ LL | #[path = ""]
184192
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
185193

186194
warning: `#[ignore]` attribute cannot be used on macro calls
187-
--> $DIR/attr-on-mac-call.rs:66:5
195+
--> $DIR/attr-on-mac-call.rs:67:5
188196
|
189197
LL | #[ignore]
190198
| ^^^^^^^^^
@@ -193,13 +201,13 @@ LL | #[ignore]
193201
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
194202

195203
warning: `#[should_panic]` attribute cannot be used on macro calls
196-
--> $DIR/attr-on-mac-call.rs:69:5
204+
--> $DIR/attr-on-mac-call.rs:70:5
197205
|
198206
LL | #[should_panic]
199207
| ^^^^^^^^^^^^^^^
200208
|
201209
= help: `#[should_panic]` can only be applied to functions
202210
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
203211

204-
warning: 22 warnings emitted
212+
error: aborting due to 1 previous error; 22 warnings emitted
205213

0 commit comments

Comments
 (0)