about summary refs log tree commit diff
path: root/tests/ui/mir/enum/single_with_repr_break.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/mir/enum/single_with_repr_break.rs')
-rw-r--r--tests/ui/mir/enum/single_with_repr_break.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/ui/mir/enum/single_with_repr_break.rs b/tests/ui/mir/enum/single_with_repr_break.rs
new file mode 100644
index 00000000000..5a4ec85a9b5
--- /dev/null
+++ b/tests/ui/mir/enum/single_with_repr_break.rs
@@ -0,0 +1,13 @@
+//@ run-fail
+//@ compile-flags: -C debug-assertions
+//@ error-pattern: trying to construct an enum from an invalid value 0x1
+
+#[allow(dead_code)]
+#[repr(u16)]
+enum Single {
+    A
+}
+
+fn main() {
+    let _val: Single = unsafe { std::mem::transmute::<u16, Single>(1) };
+}