Skip to content

Commit c25e3d2

Browse files
committed
Harden tests for repr_align_enum.
1 parent de1e1ad commit c25e3d2

File tree

2 files changed

+28
-7
lines changed

2 files changed

+28
-7
lines changed

src/test/ui/repr/repr-align.rs

+14-5
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,27 @@
11
#![allow(dead_code)]
22

33
#[repr(align(16.0))] //~ ERROR: invalid `repr(align)` attribute: not an unsuffixed integer
4-
struct A(i32);
4+
struct S0(i32);
55

66
#[repr(align(15))] //~ ERROR: invalid `repr(align)` attribute: not a power of two
7-
struct B(i32);
7+
struct S1(i32);
88

99
#[repr(align(4294967296))] //~ ERROR: invalid `repr(align)` attribute: larger than 2^29
10-
struct C(i32);
10+
struct S2(i32);
1111

1212
#[repr(align(536870912))] // ok: this is the largest accepted alignment
13-
struct D(i32);
13+
struct S3(i32);
14+
15+
#[repr(align(16.0))] //~ ERROR: invalid `repr(align)` attribute: not an unsuffixed integer
16+
enum E0 { A, B }
1417

1518
#[repr(align(15))] //~ ERROR: invalid `repr(align)` attribute: not a power of two
16-
enum E { Left, Right }
19+
enum E1 { A, B }
20+
21+
#[repr(align(4294967296))] //~ ERROR: invalid `repr(align)` attribute: larger than 2^29
22+
enum E2 { A, B }
23+
24+
#[repr(align(536870912))] // ok: this is the largest accepted alignment
25+
enum E3 { A, B }
1726

1827
fn main() {}

src/test/ui/repr/repr-align.stderr

+14-2
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,24 @@ error[E0589]: invalid `repr(align)` attribute: larger than 2^29
1616
LL | #[repr(align(4294967296))]
1717
| ^^^^^^^^^^^^^^^^^
1818

19-
error[E0589]: invalid `repr(align)` attribute: not a power of two
19+
error[E0589]: invalid `repr(align)` attribute: not an unsuffixed integer
2020
--> $DIR/repr-align.rs:15:8
2121
|
22+
LL | #[repr(align(16.0))]
23+
| ^^^^^^^^^^^
24+
25+
error[E0589]: invalid `repr(align)` attribute: not a power of two
26+
--> $DIR/repr-align.rs:18:8
27+
|
2228
LL | #[repr(align(15))]
2329
| ^^^^^^^^^
2430

25-
error: aborting due to 4 previous errors
31+
error[E0589]: invalid `repr(align)` attribute: larger than 2^29
32+
--> $DIR/repr-align.rs:21:8
33+
|
34+
LL | #[repr(align(4294967296))]
35+
| ^^^^^^^^^^^^^^^^^
36+
37+
error: aborting due to 6 previous errors
2638

2739
For more information about this error, try `rustc --explain E0589`.

0 commit comments

Comments
 (0)