Skip to content

Commit d58ea4a

Browse files
Add regression test for repr on mac call
1 parent cc4c9a0 commit d58ea4a

2 files changed

Lines changed: 102 additions & 1 deletion

File tree

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

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,34 @@ fn main() {
7070
//~^ WARN attribute cannot be used on macro calls
7171
//~| WARN previously accepted
7272
unreachable!();
73+
74+
#[repr()]
75+
//~^ WARN attribute cannot be used on macro calls
76+
//~| WARN previously accepted
77+
//~| WARN unused attribute
78+
unreachable!();
79+
#[repr(u8)]
80+
//~^ WARN attribute cannot be used on macro calls
81+
//~| WARN previously accepted
82+
unreachable!();
83+
#[repr(align(8))]
84+
//~^ WARN attribute cannot be used on macro calls
85+
//~| WARN previously accepted
86+
unreachable!();
87+
#[repr(packed)]
88+
//~^ WARN attribute cannot be used on macro calls
89+
//~| WARN previously accepted
90+
unreachable!();
91+
#[repr(C)]
92+
//~^ WARN attribute cannot be used on macro calls
93+
//~| WARN previously accepted
94+
unreachable!();
95+
#[repr(Rust)]
96+
//~^ WARN attribute cannot be used on macro calls
97+
//~| WARN previously accepted
98+
unreachable!();
99+
#[repr(simd)]
100+
//~^ WARN attribute cannot be used on macro calls
101+
//~| WARN previously accepted
102+
unreachable!();
73103
}

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

Lines changed: 72 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,5 +201,76 @@ LL | #[should_panic]
201201
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
202202
= help: `#[should_panic]` can only be applied to functions
203203

204-
warning: 22 warnings emitted
204+
warning: `#[repr()]` attribute cannot be used on macro calls
205+
--> $DIR/attr-on-mac-call.rs:74:5
206+
|
207+
LL | #[repr()]
208+
| ^^^^^^^^^
209+
|
210+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
211+
= help: `#[repr()]` can only be applied to data types
212+
213+
warning: unused attribute
214+
--> $DIR/attr-on-mac-call.rs:74:5
215+
|
216+
LL | #[repr()]
217+
| ^^^^^^^^^ help: remove this attribute
218+
|
219+
= note: using `repr` with an empty list has no effect
220+
221+
warning: `#[repr(u8)]` attribute cannot be used on macro calls
222+
--> $DIR/attr-on-mac-call.rs:79:5
223+
|
224+
LL | #[repr(u8)]
225+
| ^^^^^^^^^^^
226+
|
227+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
228+
= help: `#[repr(u8)]` can only be applied to enums
229+
230+
warning: `#[repr(align(...))]` attribute cannot be used on macro calls
231+
--> $DIR/attr-on-mac-call.rs:83:5
232+
|
233+
LL | #[repr(align(8))]
234+
| ^^^^^^^^^^^^^^^^^
235+
|
236+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
237+
= help: `#[repr(align(...))]` can only be applied to data types
238+
239+
warning: `#[repr(packed)]` attribute cannot be used on macro calls
240+
--> $DIR/attr-on-mac-call.rs:87:5
241+
|
242+
LL | #[repr(packed)]
243+
| ^^^^^^^^^^^^^^^
244+
|
245+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
246+
= help: `#[repr(packed)]` can only be applied to data types
247+
248+
warning: `#[repr(C)]` attribute cannot be used on macro calls
249+
--> $DIR/attr-on-mac-call.rs:91:5
250+
|
251+
LL | #[repr(C)]
252+
| ^^^^^^^^^^
253+
|
254+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
255+
= help: `#[repr(C)]` can only be applied to data types
256+
257+
warning: `#[repr(Rust)]` attribute cannot be used on macro calls
258+
--> $DIR/attr-on-mac-call.rs:95:5
259+
|
260+
LL | #[repr(Rust)]
261+
| ^^^^^^^^^^^^^
262+
|
263+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
264+
= help: `#[repr(Rust)]` can only be applied to data types
265+
266+
warning: `#[repr(simd)]` attribute cannot be used on macro calls
267+
--> $DIR/attr-on-mac-call.rs:99:5
268+
|
269+
LL | #[repr(simd)]
270+
| ^^^^^^^^^^^^^
271+
|
272+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
273+
= help: `#[repr(simd)]` can only be applied to structs
274+
275+
warning: 30 warnings emitted
205276

0 commit comments

Comments
 (0)