about summary refs log tree commit diff
path: root/src/test/ui/aligned_enum_cast.rs
diff options
context:
space:
mode:
authorouz-a <oguz.agcayazi@gmail.com>2022-01-15 15:03:38 +0300
committerouz-a <oguz.agcayazi@gmail.com>2022-02-01 13:01:19 +0300
commitfd5be23a96274cb1d1f83acdd8f7370ee15e00fa (patch)
treecfe8626a398fd2184d884ad1e1b800535da0627c /src/test/ui/aligned_enum_cast.rs
parent38c22af0153cf8f920c01ef04493e8878401fd18 (diff)
downloadrust-fd5be23a96274cb1d1f83acdd8f7370ee15e00fa.tar.gz
rust-fd5be23a96274cb1d1f83acdd8f7370ee15e00fa.zip
fix for the issue #92464
Diffstat (limited to 'src/test/ui/aligned_enum_cast.rs')
-rw-r--r--src/test/ui/aligned_enum_cast.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/test/ui/aligned_enum_cast.rs b/src/test/ui/aligned_enum_cast.rs
new file mode 100644
index 00000000000..4b5776a6aa8
--- /dev/null
+++ b/src/test/ui/aligned_enum_cast.rs
@@ -0,0 +1,15 @@
+// run-pass
+// allows aligned custom discriminant enums to cast into other types
+// See the issue #92464 for more info
+#[allow(dead_code)]
+#[repr(align(8))]
+enum Aligned {
+    Zero = 0,
+    One = 1,
+}
+
+fn main() {
+    let aligned = Aligned::Zero;
+    let fo = aligned as u8;
+    println!("foo {}",fo);
+}