about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-08-23 06:55:28 +0200
committerGitHub <noreply@github.com>2022-08-23 06:55:28 +0200
commitf5fcac99787d42a707f51a893725afa17f35277e (patch)
tree32be96ea1dd8de452797a180675fd6e37b30e1b5 /src
parent21d8f484d7f20c3482c322dd332b297cdc15cbfc (diff)
parentd7ee421870f8937fe351b4143036c2730129757a (diff)
downloadrust-f5fcac99787d42a707f51a893725afa17f35277e.tar.gz
rust-f5fcac99787d42a707f51a893725afa17f35277e.zip
Rollup merge of #100861 - RalfJung:const-ice, r=oli-obk
fix ICE with extra-const-ub-checks

Fixes https://github.com/rust-lang/rust/issues/100771
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/consts/extra-const-ub/issue-100771.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/test/ui/consts/extra-const-ub/issue-100771.rs b/src/test/ui/consts/extra-const-ub/issue-100771.rs
new file mode 100644
index 00000000000..a3296032841
--- /dev/null
+++ b/src/test/ui/consts/extra-const-ub/issue-100771.rs
@@ -0,0 +1,20 @@
+// check-pass
+// compile-flags: -Zextra-const-ub-checks
+
+#[derive(PartialEq, Eq, Copy, Clone)]
+#[repr(packed)]
+struct Foo {
+    field: (i64, u32, u32, u32),
+}
+
+const FOO: Foo = Foo {
+    field: (5, 6, 7, 8),
+};
+
+fn main() {
+    match FOO {
+        Foo { field: (5, 6, 7, 8) } => {},
+        FOO => unreachable!(),
+        _ => unreachable!(),
+    }
+}