rust/tests/ui/typeck/issue-114529-illegal-break-...

45 lines
1.5 KiB
Plaintext

error[E0571]: `break` with value from a `while` loop
--> $DIR/issue-114529-illegal-break-with-value.rs:9:13
|
LL | while true {
| ---------- you can't `break` with a value in a `while` loop
LL | break 9;
| ^^^^^^^ can only break with a value inside `loop` or breakable block
|
help: use `break` on its own without a value inside this `while` loop
|
LL | break;
| ~~~~~
error[E0571]: `break` with value from a `while` loop
--> $DIR/issue-114529-illegal-break-with-value.rs:16:13
|
LL | while let Some(v) = Some(9) {
| --------------------------- you can't `break` with a value in a `while` loop
LL | break v;
| ^^^^^^^ can only break with a value inside `loop` or breakable block
|
help: use `break` on its own without a value inside this `while` loop
|
LL | break;
| ~~~~~
error[E0571]: `break` with value from a `while` loop
--> $DIR/issue-114529-illegal-break-with-value.rs:22:9
|
LL | while true {
| ---------- you can't `break` with a value in a `while` loop
LL | / break (|| {
LL | | let local = 9;
LL | | });
| |__________^ can only break with a value inside `loop` or breakable block
|
help: use `break` on its own without a value inside this `while` loop
|
LL | break;
| ~~~~~
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0571`.