about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorTomasz Miąsko <tomasz.miasko@gmail.com>2021-03-20 00:00:00 +0000
committerTomasz Miąsko <tomasz.miasko@gmail.com>2021-07-15 18:17:27 +0200
commitd49f977ed9fef7bc0734693eb6f6b1f41b72735e (patch)
tree92b90c3fd472b692d913a2394662823fd4cb555c /src/test
parentb9197978a90be6f7570741eabe2da175fec75375 (diff)
Layout error instead of an ICE for packed and aligned types
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/conflicting-repr-hints.rs11
-rw-r--r--src/test/ui/conflicting-repr-hints.stderr16
2 files changed, 26 insertions, 1 deletions
diff --git a/src/test/ui/conflicting-repr-hints.rs b/src/test/ui/conflicting-repr-hints.rs
index 09dade20992..ed82b6a742c 100644
--- a/src/test/ui/conflicting-repr-hints.rs
+++ b/src/test/ui/conflicting-repr-hints.rs
@@ -66,4 +66,15 @@ union Z {
     i: i32,
 }
 
+#[repr(packed, align(0x100))]
+pub struct S(u16); //~ ERROR type has conflicting packed and align representation hints
+
+#[repr(packed, align(0x100))]
+pub union U { //~ ERROR type has conflicting packed and align representation hints
+    u: u16
+}
+
+static B: U = U { u: 0 };
+static A: S = S(0);
+
 fn main() {}
diff --git a/src/test/ui/conflicting-repr-hints.stderr b/src/test/ui/conflicting-repr-hints.stderr
index 0b78532c737..0f32fc0481b 100644
--- a/src/test/ui/conflicting-repr-hints.stderr
+++ b/src/test/ui/conflicting-repr-hints.stderr
@@ -74,7 +74,21 @@ LL | |     i: i32,
 LL | | }
    | |_^
 
-error: aborting due to 10 previous errors
+error[E0587]: type has conflicting packed and align representation hints
+  --> $DIR/conflicting-repr-hints.rs:70:1
+   |
+LL | pub struct S(u16);
+   | ^^^^^^^^^^^^^^^^^^
+
+error[E0587]: type has conflicting packed and align representation hints
+  --> $DIR/conflicting-repr-hints.rs:73:1
+   |
+LL | / pub union U {
+LL | |     u: u16
+LL | | }
+   | |_^
+
+error: aborting due to 12 previous errors
 
 Some errors have detailed explanations: E0566, E0587, E0634.
 For more information about an error, try `rustc --explain E0566`.