Add more tests for #[repr(align(x))] on enums

This commit is contained in:
Niklas Fiekas 2019-01-31 14:18:31 +01:00
parent c6f6101180
commit 73bf0703a7
3 changed files with 57 additions and 9 deletions

View file

@ -1,3 +1,4 @@
#![feature(repr_align_enum)]
#![allow(dead_code)]
#[repr(align(16.0))] //~ ERROR: invalid `repr(align)` attribute: not an unsuffixed integer
@ -12,4 +13,7 @@ struct C(i32);
#[repr(align(536870912))] // ok: this is the largest accepted alignment
struct D(i32);
#[repr(align(15))] //~ ERROR: invalid `repr(align)` attribute: not a power of two
enum E { Left, Right }
fn main() {}

View file

@ -1,21 +1,27 @@
error[E0589]: invalid `repr(align)` attribute: not an unsuffixed integer
--> $DIR/repr-align.rs:3:8
--> $DIR/repr-align.rs:4:8
|
LL | #[repr(align(16.0))] //~ ERROR: invalid `repr(align)` attribute: not an unsuffixed integer
| ^^^^^^^^^^^
error[E0589]: invalid `repr(align)` attribute: not a power of two
--> $DIR/repr-align.rs:6:8
--> $DIR/repr-align.rs:7:8
|
LL | #[repr(align(15))] //~ ERROR: invalid `repr(align)` attribute: not a power of two
| ^^^^^^^^^
error[E0589]: invalid `repr(align)` attribute: larger than 2^29
--> $DIR/repr-align.rs:9:8
--> $DIR/repr-align.rs:10:8
|
LL | #[repr(align(4294967296))] //~ ERROR: invalid `repr(align)` attribute: larger than 2^29
| ^^^^^^^^^^^^^^^^^
error: aborting due to 3 previous errors
error[E0589]: invalid `repr(align)` attribute: not a power of two
--> $DIR/repr-align.rs:16:8
|
LL | #[repr(align(15))] //~ ERROR: invalid `repr(align)` attribute: not a power of two
| ^^^^^^^^^
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0589`.