diff --git a/tests/ui/never_loop.rs b/tests/ui/never_loop.rs index 50b8d4994..ff0126704 100644 --- a/tests/ui/never_loop.rs +++ b/tests/ui/never_loop.rs @@ -54,7 +54,7 @@ fn test5() { fn test6() { let mut x = 0; - 'outer: loop { // never loops + 'outer: loop { x += 1; loop { // never loops if x == 5 { break } @@ -112,6 +112,20 @@ fn test11 i32>(mut f: F) { } } +pub fn test12(a: bool, b: bool) { + 'label: loop { + loop { + if a { + continue 'label; + } + if b { + break; + } + } + break; + } +} + fn main() { test1(); test2(); @@ -124,5 +138,6 @@ fn main() { test9(); test10(); test11(|| 0); + test12(true, false); } diff --git a/tests/ui/never_loop.stderr b/tests/ui/never_loop.stderr index d1bfc4a95..dace2b7e2 100644 --- a/tests/ui/never_loop.stderr +++ b/tests/ui/never_loop.stderr @@ -40,18 +40,6 @@ error: this loop never actually loops 50 | | } | |_________^ -error: this loop never actually loops - --> $DIR/never_loop.rs:57:5 - | -57 | / 'outer: loop { // never loops -58 | | x += 1; -59 | | loop { // never loops -60 | | if x == 5 { break } -... | -63 | | return -64 | | } - | |__^ - error: this loop never actually loops --> $DIR/never_loop.rs:59:3 | @@ -80,5 +68,5 @@ error: this loop never actually loops 103 | | } | |_____^ -error: aborting due to 8 previous errors +error: aborting due to 7 previous errors