File tree Expand file tree Collapse file tree 2 files changed +57
-0
lines changed Expand file tree Collapse file tree 2 files changed +57
-0
lines changed Original file line number Diff line number Diff line change
1
+ // Tests a few different invalid repr attributes
2
+
3
+ // This is a regression test for https://github.com/rust-lang/rust/issues/143522
4
+ #![ repr]
5
+ //~^ ERROR malformed `repr` attribute input [E0539]
6
+ //~| ERROR `repr` attribute cannot be used at crate level
7
+
8
+ // This is a regression test for https://github.com/rust-lang/rust/issues/143479
9
+ #[ repr( align( 0 ) ) ]
10
+ //~^ ERROR invalid `repr(align)` attribute: not a power of two
11
+ //~| ERROR unsupported representation for zero-variant enum [E0084]
12
+ enum Foo { }
13
+
14
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ error[E0539]: malformed `repr` attribute input
2
+ --> $DIR/malformed-reprs.rs:4:1
3
+ |
4
+ LL | #![repr]
5
+ | ^^^^^^^^
6
+ | |
7
+ | expected this to be a list
8
+ | help: must be of the form: `#[repr(C | Rust | align(...) | packed(...) | <integer type> | transparent)]`
9
+
10
+ error[E0589]: invalid `repr(align)` attribute: not a power of two
11
+ --> $DIR/malformed-reprs.rs:9:14
12
+ |
13
+ LL | #[repr(align(0))]
14
+ | ^
15
+
16
+ error: `repr` attribute cannot be used at crate level
17
+ --> $DIR/malformed-reprs.rs:4:1
18
+ |
19
+ LL | #![repr]
20
+ | ^^^^^^^^
21
+ ...
22
+ LL | enum Foo {}
23
+ | --- the inner attribute doesn't annotate this enum
24
+ |
25
+ help: perhaps you meant to use an outer attribute
26
+ |
27
+ LL - #![repr]
28
+ LL + #[repr]
29
+ |
30
+
31
+ error[E0084]: unsupported representation for zero-variant enum
32
+ --> $DIR/malformed-reprs.rs:9:1
33
+ |
34
+ LL | #[repr(align(0))]
35
+ | ^^^^^^^^^^^^^^^^^
36
+ ...
37
+ LL | enum Foo {}
38
+ | -------- zero-variant enum
39
+
40
+ error: aborting due to 4 previous errors
41
+
42
+ Some errors have detailed explanations: E0084, E0539, E0589.
43
+ For more information about an error, try `rustc --explain E0084`.
You can’t perform that action at this time.
0 commit comments