about summary refs log tree commit diff
path: root/tests/ui/loop-match/const-continue-to-block.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/loop-match/const-continue-to-block.rs')
-rw-r--r--tests/ui/loop-match/const-continue-to-block.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/ui/loop-match/const-continue-to-block.rs b/tests/ui/loop-match/const-continue-to-block.rs
index fd7ebeefeb6..a0f60aaec33 100644
--- a/tests/ui/loop-match/const-continue-to-block.rs
+++ b/tests/ui/loop-match/const-continue-to-block.rs
@@ -24,3 +24,24 @@ fn const_continue_to_block() -> u8 {
         }
     }
 }
+
+fn const_continue_to_shadowed_block() -> u8 {
+    let state = 0;
+    #[loop_match]
+    loop {
+        state = 'blk: {
+            match state {
+                0 => {
+                    #[const_continue]
+                    break 'blk 1;
+                }
+                _ => 'blk: {
+                    //~^ WARN label name `'blk` shadows a label name that is already in scope
+                    #[const_continue]
+                    break 'blk 2;
+                    //~^ ERROR `#[const_continue]` must break to a labeled block that participates in a `#[loop_match]`
+                }
+            }
+        }
+    }
+}