]> git.lizzy.rs Git - rust.git/commitdiff
Harden tests for repr_align_enum.
authorMazdak Farrokhzad <twingoow@gmail.com>
Mon, 27 May 2019 05:35:48 +0000 (07:35 +0200)
committerMazdak Farrokhzad <twingoow@gmail.com>
Mon, 27 May 2019 05:35:48 +0000 (07:35 +0200)
src/test/ui/repr/repr-align.rs
src/test/ui/repr/repr-align.stderr

index 2e90360aff2f19fbbd531d2357dab9aa897ce3c4..bc6a9fe562a6790289f279a36c01d2f628bef3c7 100644 (file)
@@ -1,18 +1,27 @@
 #![allow(dead_code)]
 
 #[repr(align(16.0))] //~ ERROR: invalid `repr(align)` attribute: not an unsuffixed integer
-struct A(i32);
+struct S0(i32);
 
 #[repr(align(15))] //~ ERROR: invalid `repr(align)` attribute: not a power of two
-struct B(i32);
+struct S1(i32);
 
 #[repr(align(4294967296))] //~ ERROR: invalid `repr(align)` attribute: larger than 2^29
-struct C(i32);
+struct S2(i32);
 
 #[repr(align(536870912))] // ok: this is the largest accepted alignment
-struct D(i32);
+struct S3(i32);
+
+#[repr(align(16.0))] //~ ERROR: invalid `repr(align)` attribute: not an unsuffixed integer
+enum E0 { A, B }
 
 #[repr(align(15))] //~ ERROR: invalid `repr(align)` attribute: not a power of two
-enum E { Left, Right }
+enum E1 { A, B }
+
+#[repr(align(4294967296))] //~ ERROR: invalid `repr(align)` attribute: larger than 2^29
+enum E2 { A, B }
+
+#[repr(align(536870912))] // ok: this is the largest accepted alignment
+enum E3 { A, B }
 
 fn main() {}
index 645ed0c8ad3b15cb3abc5d03d838c419bc991eef..280cab2b4a144fed2ff097ec02ac54bbb4a09d50 100644 (file)
@@ -16,12 +16,24 @@ error[E0589]: invalid `repr(align)` attribute: larger than 2^29
 LL | #[repr(align(4294967296))]
    |        ^^^^^^^^^^^^^^^^^
 
-error[E0589]: invalid `repr(align)` attribute: not a power of two
+error[E0589]: invalid `repr(align)` attribute: not an unsuffixed integer
   --> $DIR/repr-align.rs:15:8
    |
+LL | #[repr(align(16.0))]
+   |        ^^^^^^^^^^^
+
+error[E0589]: invalid `repr(align)` attribute: not a power of two
+  --> $DIR/repr-align.rs:18:8
+   |
 LL | #[repr(align(15))]
    |        ^^^^^^^^^
 
-error: aborting due to 4 previous errors
+error[E0589]: invalid `repr(align)` attribute: larger than 2^29
+  --> $DIR/repr-align.rs:21:8
+   |
+LL | #[repr(align(4294967296))]
+   |        ^^^^^^^^^^^^^^^^^
+
+error: aborting due to 6 previous errors
 
 For more information about this error, try `rustc --explain E0589`.