Specify that break cannot be used outside of loop *or* labeled block
This commit is contained in:
parent
09508489ef
commit
2f882c014f
14 changed files with 37 additions and 30 deletions
|
|
@ -9,11 +9,11 @@ LL | break 'lab;
|
|||
|
|
||||
= note: labels are unreachable through functions, closures, async blocks and modules
|
||||
|
||||
error[E0268]: `break` outside of a loop
|
||||
error[E0268]: `break` outside of a loop or labeled block
|
||||
--> $DIR/break-outside-loop.rs:10:15
|
||||
|
|
||||
LL | let pth = break;
|
||||
| ^^^^^ cannot `break` outside of a loop
|
||||
| ^^^^^ cannot `break` outside of a loop or labeled block
|
||||
|
||||
error[E0268]: `continue` outside of a loop
|
||||
--> $DIR/break-outside-loop.rs:11:17
|
||||
|
|
@ -38,11 +38,11 @@ LL | if cond() { break }
|
|||
LL | if cond() { continue }
|
||||
| ^^^^^^^^ cannot `continue` inside of a closure
|
||||
|
||||
error[E0268]: `break` outside of a loop
|
||||
error[E0268]: `break` outside of a loop or labeled block
|
||||
--> $DIR/break-outside-loop.rs:24:25
|
||||
|
|
||||
LL | let unconstrained = break;
|
||||
| ^^^^^ cannot `break` outside of a loop
|
||||
| ^^^^^ cannot `break` outside of a loop or labeled block
|
||||
|
||||
error[E0267]: `break` inside of a closure
|
||||
--> $DIR/break-outside-loop.rs:30:13
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue