about summary refs log tree commit diff
path: root/tests/ui/layout/debug.rs
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2022-11-03 14:45:42 +0000
committerLuqman Aden <me@luqman.ca>2023-05-05 16:00:12 -0700
commit23d09aebc8c6b89ba86bce2c38a0fc31f227d722 (patch)
tree33b3561379853e88c543efe90c36df9002280ff0 /tests/ui/layout/debug.rs
parent4b94c232192b0fa0314b5afa18e366356e210c4c (diff)
downloadrust-23d09aebc8c6b89ba86bce2c38a0fc31f227d722.tar.gz
rust-23d09aebc8c6b89ba86bce2c38a0fc31f227d722.zip
Do not use scalar layout if there are ZSTs with alignment > 1
Diffstat (limited to 'tests/ui/layout/debug.rs')
-rw-r--r--tests/ui/layout/debug.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/ui/layout/debug.rs b/tests/ui/layout/debug.rs
index a282e71235c..c506b98f16e 100644
--- a/tests/ui/layout/debug.rs
+++ b/tests/ui/layout/debug.rs
@@ -17,6 +17,27 @@ type Test = Result<i32, i32>; //~ ERROR: layout_of
 #[rustc_layout(debug)]
 type T = impl std::fmt::Debug; //~ ERROR: layout_of
 
+#[rustc_layout(debug)]
+pub union V { //~ ERROR: layout_of
+    a: [u16; 0],
+    b: u8,
+}
+
+#[rustc_layout(debug)]
+pub union W { //~ ERROR: layout_of
+    b: u8,
+    a: [u16; 0],
+}
+
+#[rustc_layout(debug)]
+pub union Y { //~ ERROR: layout_of
+    b: [u8; 0],
+    a: [u16; 0],
+}
+
+#[rustc_layout(debug)]
+type X = std::mem::MaybeUninit<u8>; //~ ERROR: layout_of
+
 fn f() -> T {
     0i32
 }