mirror of
https://github.com/rust-lang/rust.git
synced 2025-10-03 02:40:40 +00:00
Regression tests for repr ICEs
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
This commit is contained in:
parent
de031bbcb1
commit
f7046bd32a
14
tests/ui/attributes/malformed-reprs.rs
Normal file
14
tests/ui/attributes/malformed-reprs.rs
Normal file
@ -0,0 +1,14 @@
|
||||
// Tests a few different invalid repr attributes
|
||||
|
||||
// This is a regression test for https://github.com/rust-lang/rust/issues/143522
|
||||
#![repr]
|
||||
//~^ ERROR malformed `repr` attribute input [E0539]
|
||||
//~| ERROR `repr` attribute cannot be used at crate level
|
||||
|
||||
// This is a regression test for https://github.com/rust-lang/rust/issues/143479
|
||||
#[repr(align(0))]
|
||||
//~^ ERROR invalid `repr(align)` attribute: not a power of two
|
||||
//~| ERROR unsupported representation for zero-variant enum [E0084]
|
||||
enum Foo {}
|
||||
|
||||
fn main() {}
|
43
tests/ui/attributes/malformed-reprs.stderr
Normal file
43
tests/ui/attributes/malformed-reprs.stderr
Normal file
@ -0,0 +1,43 @@
|
||||
error[E0539]: malformed `repr` attribute input
|
||||
--> $DIR/malformed-reprs.rs:4:1
|
||||
|
|
||||
LL | #![repr]
|
||||
| ^^^^^^^^
|
||||
| |
|
||||
| expected this to be a list
|
||||
| help: must be of the form: `#[repr(C | Rust | align(...) | packed(...) | <integer type> | transparent)]`
|
||||
|
||||
error[E0589]: invalid `repr(align)` attribute: not a power of two
|
||||
--> $DIR/malformed-reprs.rs:9:14
|
||||
|
|
||||
LL | #[repr(align(0))]
|
||||
| ^
|
||||
|
||||
error: `repr` attribute cannot be used at crate level
|
||||
--> $DIR/malformed-reprs.rs:4:1
|
||||
|
|
||||
LL | #![repr]
|
||||
| ^^^^^^^^
|
||||
...
|
||||
LL | enum Foo {}
|
||||
| --- the inner attribute doesn't annotate this enum
|
||||
|
|
||||
help: perhaps you meant to use an outer attribute
|
||||
|
|
||||
LL - #![repr]
|
||||
LL + #[repr]
|
||||
|
|
||||
|
||||
error[E0084]: unsupported representation for zero-variant enum
|
||||
--> $DIR/malformed-reprs.rs:9:1
|
||||
|
|
||||
LL | #[repr(align(0))]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
...
|
||||
LL | enum Foo {}
|
||||
| -------- zero-variant enum
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0084, E0539, E0589.
|
||||
For more information about an error, try `rustc --explain E0084`.
|
Loading…
x
Reference in New Issue
Block a user