summary refs log tree commit diff
path: root/tests/ui/inline-const/const-block-pat-liveness.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/inline-const/const-block-pat-liveness.rs')
-rw-r--r--tests/ui/inline-const/const-block-pat-liveness.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/ui/inline-const/const-block-pat-liveness.rs b/tests/ui/inline-const/const-block-pat-liveness.rs
new file mode 100644
index 00000000000..26393a4f65b
--- /dev/null
+++ b/tests/ui/inline-const/const-block-pat-liveness.rs
@@ -0,0 +1,18 @@
+//! This test used to ICE because const blocks didn't have a body
+//! anymore, making a lot of logic very fragile around handling the
+//! HIR of a const block.
+//! https://github.com/rust-lang/rust/issues/125846
+
+//@ check-pass
+
+#![feature(inline_const_pat)]
+
+fn main() {
+    match 0 {
+        const {
+            let a = 10_usize;
+            *&a
+        }
+        | _ => {}
+    }
+}