Skip to content

Commit dc7d77f

Browse files
committed
Add a test for break
1 parent 4efd5c7 commit dc7d77f

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/test/ui/closure-array-break-length.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,6 @@ fn main() {
1212
|_: [_; continue]| {}; //~ ERROR: `continue` outside of loop
1313

1414
while |_: [_; continue]| {} {} //~ ERROR: `break` or `continue` with no label
15+
16+
while |_: [_; break]| {} {} //~ ERROR: `break` or `continue` with no label
1517
}

src/test/ui/closure-array-break-length.stderr

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@ error[E0590]: `break` or `continue` with no label in the condition of a `while`
1010
LL | while |_: [_; continue]| {} {} //~ ERROR: `break` or `continue` with no label
1111
| ^^^^^^^^ unlabeled `continue` in the condition of a `while` loop
1212

13-
error: aborting due to 2 previous errors
13+
error[E0590]: `break` or `continue` with no label in the condition of a `while` loop
14+
--> $DIR/closure-array-break-length.rs:16:19
15+
|
16+
LL | while |_: [_; break]| {} {} //~ ERROR: `break` or `continue` with no label
17+
| ^^^^^ unlabeled `break` in the condition of a `while` loop
18+
19+
error: aborting due to 3 previous errors
1420

1521
Some errors occurred: E0268, E0590.
1622
For more information about an error, try `rustc --explain E0268`.

0 commit comments

Comments
 (0)