summaryrefslogtreecommitdiffstats
path: root/tests/ui/loops/loop-break-value.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/ui/loops/loop-break-value.rs63
1 files changed, 63 insertions, 0 deletions
diff --git a/tests/ui/loops/loop-break-value.rs b/tests/ui/loops/loop-break-value.rs
index 51c9a36a0..c35200520 100644
--- a/tests/ui/loops/loop-break-value.rs
+++ b/tests/ui/loops/loop-break-value.rs
@@ -95,4 +95,67 @@ fn main() {
break LOOP;
//~^ ERROR cannot find value `LOOP` in this scope
}
+
+ let _ = 'a: loop {
+ loop {
+ break; // This doesn't affect the expected break type of the 'a loop
+ loop {
+ loop {
+ break 'a 1;
+ }
+ }
+ }
+ break; //~ ERROR mismatched types
+ };
+
+ let _ = 'a: loop {
+ loop {
+ break; // This doesn't affect the expected break type of the 'a loop
+ loop {
+ loop {
+ break 'a 1;
+ }
+ }
+ }
+ break 'a; //~ ERROR mismatched types
+ };
+
+ loop {
+ break;
+ let _ = loop {
+ break 2;
+ loop {
+ break;
+ }
+ };
+ break 2; //~ ERROR mismatched types
+ }
+
+ 'a: loop {
+ break;
+ let _ = 'a: loop {
+ //~^ WARNING label name `'a` shadows a label name that is already in scope
+ break 2;
+ loop {
+ break 'a; //~ ERROR mismatched types
+ }
+ };
+ break 2; //~ ERROR mismatched types
+ }
+
+ 'a: loop {
+ break;
+ let _ = 'a: loop {
+ //~^ WARNING label name `'a` shadows a label name that is already in scope
+ break 'a 2;
+ loop {
+ break 'a; //~ ERROR mismatched types
+ }
+ };
+ break 2; //~ ERROR mismatched types
+ };
+
+ loop { // point at the return type
+ break 2; //~ ERROR mismatched types
+ }
}