about summary refs log tree commit diff
path: root/tests/ui/loop-match/panic-in-const.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/loop-match/panic-in-const.rs')
-rw-r--r--tests/ui/loop-match/panic-in-const.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/ui/loop-match/panic-in-const.rs b/tests/ui/loop-match/panic-in-const.rs
new file mode 100644
index 00000000000..2ae67445496
--- /dev/null
+++ b/tests/ui/loop-match/panic-in-const.rs
@@ -0,0 +1,22 @@
+#![allow(incomplete_features)]
+#![feature(loop_match)]
+#![crate_type = "lib"]
+
+const CONST_THAT_PANICS: u8 = panic!("diverge!");
+//~^ ERROR: evaluation panicked: diverge!
+
+fn test(mut state: u8) {
+    #[loop_match]
+    loop {
+        state = 'blk: {
+            match state {
+                0 => {
+                    #[const_continue]
+                    break 'blk CONST_THAT_PANICS;
+                }
+
+                _ => unreachable!(),
+            }
+        }
+    }
+}