rust/tests/ui/loops/loop-break-value.stderr

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

194 lines
6.2 KiB
Plaintext
Raw Normal View History

error[E0425]: cannot find value `LOOP` in this scope
--> $DIR/loop-break-value.rs:95:15
|
LL | 'LOOP: for _ in 0 .. 9 {
| ----- a label with a similar name exists
LL | break LOOP;
| ^^^^
| |
| not found in this scope
| help: use the similarly named label: `'LOOP`
warning: denote infinite loops with `loop { ... }`
--> $DIR/loop-break-value.rs:26:5
|
LL | 'while_loop: while true {
| ^^^^^^^^^^^^^^^^^^^^^^^ help: use `loop`
|
= note: `#[warn(while_true)]` on by default
2018-08-08 07:28:26 -05:00
error[E0571]: `break` with value from a `while` loop
--> $DIR/loop-break-value.rs:28:9
2018-08-08 07:28:26 -05:00
|
LL | 'while_loop: while true {
| ----------------------- you can't `break` with a value in a `while` loop
LL | break;
2019-03-09 06:03:44 -06:00
LL | break ();
2018-08-08 07:28:26 -05:00
| ^^^^^^^^ can only break with a value inside `loop` or breakable block
|
help: use `break` on its own without a value inside this `while` loop
2018-08-08 07:28:26 -05:00
|
2019-03-09 06:03:44 -06:00
LL | break;
| ~~~~~
help: alternatively, you might have meant to use the available loop label
|
LL | break 'while_loop;
| ~~~~~~~~~~~
2018-08-08 07:28:26 -05:00
error[E0571]: `break` with value from a `while` loop
--> $DIR/loop-break-value.rs:30:13
2018-08-08 07:28:26 -05:00
|
LL | 'while_loop: while true {
| ----------------------- you can't `break` with a value in a `while` loop
...
2018-08-08 07:28:26 -05:00
LL | break 'while_loop 123;
| ^^^^^^^^^^^^^^^^^^^^^ can only break with a value inside `loop` or breakable block
|
help: use `break` on its own without a value inside this `while` loop
2018-08-08 07:28:26 -05:00
|
LL | break 'while_loop;
| ~~~~~~~~~~~~~~~~~
2018-08-08 07:28:26 -05:00
error[E0571]: `break` with value from a `while` loop
--> $DIR/loop-break-value.rs:38:12
2018-08-08 07:28:26 -05:00
|
LL | while let Some(_) = Some(()) {
| ---------------------------- you can't `break` with a value in a `while` loop
2019-03-09 06:03:44 -06:00
LL | if break () {
2018-08-08 07:28:26 -05:00
| ^^^^^^^^ can only break with a value inside `loop` or breakable block
|
help: use `break` on its own without a value inside this `while` loop
2018-08-08 07:28:26 -05:00
|
2019-03-09 06:03:44 -06:00
LL | if break {
| ~~~~~
2018-08-08 07:28:26 -05:00
error[E0571]: `break` with value from a `while` loop
--> $DIR/loop-break-value.rs:43:9
2018-08-08 07:28:26 -05:00
|
LL | while let Some(_) = Some(()) {
| ---------------------------- you can't `break` with a value in a `while` loop
2018-08-08 07:28:26 -05:00
LL | break None;
| ^^^^^^^^^^ can only break with a value inside `loop` or breakable block
|
help: use `break` on its own without a value inside this `while` loop
2018-08-08 07:28:26 -05:00
|
LL | break;
| ~~~~~
2018-08-08 07:28:26 -05:00
error[E0571]: `break` with value from a `while` loop
--> $DIR/loop-break-value.rs:49:13
2018-08-08 07:28:26 -05:00
|
LL | 'while_let_loop: while let Some(_) = Some(()) {
| --------------------------------------------- you can't `break` with a value in a `while` loop
LL | loop {
2018-08-08 07:28:26 -05:00
LL | break 'while_let_loop "nope";
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can only break with a value inside `loop` or breakable block
|
help: use `break` on its own without a value inside this `while` loop
2018-08-08 07:28:26 -05:00
|
LL | break 'while_let_loop;
| ~~~~~~~~~~~~~~~~~~~~~
2018-08-08 07:28:26 -05:00
error[E0571]: `break` with value from a `for` loop
--> $DIR/loop-break-value.rs:56:9
2018-08-08 07:28:26 -05:00
|
LL | for _ in &[1,2,3] {
| ----------------- you can't `break` with a value in a `for` loop
2019-03-09 06:03:44 -06:00
LL | break ();
2018-08-08 07:28:26 -05:00
| ^^^^^^^^ can only break with a value inside `loop` or breakable block
|
help: use `break` on its own without a value inside this `for` loop
2018-08-08 07:28:26 -05:00
|
2019-03-09 06:03:44 -06:00
LL | break;
| ~~~~~
2018-08-08 07:28:26 -05:00
error[E0571]: `break` with value from a `for` loop
--> $DIR/loop-break-value.rs:57:9
2018-08-08 07:28:26 -05:00
|
LL | for _ in &[1,2,3] {
| ----------------- you can't `break` with a value in a `for` loop
LL | break ();
2018-08-08 07:28:26 -05:00
LL | break [()];
| ^^^^^^^^^^ can only break with a value inside `loop` or breakable block
|
help: use `break` on its own without a value inside this `for` loop
2018-08-08 07:28:26 -05:00
|
LL | break;
| ~~~~~
2018-08-08 07:28:26 -05:00
error[E0571]: `break` with value from a `for` loop
--> $DIR/loop-break-value.rs:64:13
2018-08-08 07:28:26 -05:00
|
LL | 'for_loop: for _ in &[1,2,3] {
| ---------------------------- you can't `break` with a value in a `for` loop
...
2018-08-08 07:28:26 -05:00
LL | break 'for_loop Some(17);
| ^^^^^^^^^^^^^^^^^^^^^^^^ can only break with a value inside `loop` or breakable block
|
help: use `break` on its own without a value inside this `for` loop
2018-08-08 07:28:26 -05:00
|
LL | break 'for_loop;
| ~~~~~~~~~~~~~~~
2018-08-08 07:28:26 -05:00
error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:4:31
2018-08-08 07:28:26 -05:00
|
LL | let val: ! = loop { break break; };
| ^^^^^ expected `!`, found `()`
2018-08-08 07:28:26 -05:00
|
2019-11-14 16:08:08 -06:00
= note: expected type `!`
found unit type `()`
2018-08-08 07:28:26 -05:00
error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:11:19
2018-08-08 07:28:26 -05:00
|
2019-03-09 06:03:44 -06:00
LL | break 123;
| ^^^ expected `&str`, found integer
2018-08-08 07:28:26 -05:00
error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:16:15
2018-08-08 07:28:26 -05:00
|
2019-03-09 06:03:44 -06:00
LL | break "asdf";
| ^^^^^^ expected `i32`, found `&str`
2018-08-08 07:28:26 -05:00
error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:21:31
2018-08-08 07:28:26 -05:00
|
2019-03-09 06:03:44 -06:00
LL | break 'outer_loop "nope";
| ^^^^^^ expected `i32`, found `&str`
2018-08-08 07:28:26 -05:00
error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:73:26
2018-08-08 07:28:26 -05:00
|
2019-03-09 06:03:44 -06:00
LL | break 'c 123;
| ^^^ expected `()`, found integer
2018-08-08 07:28:26 -05:00
error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:80:15
2018-08-08 07:28:26 -05:00
|
2019-03-09 06:03:44 -06:00
LL | break (break, break);
| ^^^^^^^^^^^^^^ expected `()`, found `(!, !)`
2018-08-08 07:28:26 -05:00
|
2019-11-14 16:08:08 -06:00
= note: expected unit type `()`
found tuple `(!, !)`
2018-08-08 07:28:26 -05:00
error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:85:15
2018-08-08 07:28:26 -05:00
|
2019-03-09 06:03:44 -06:00
LL | break 2;
| ^ expected `()`, found integer
2018-08-08 07:28:26 -05:00
error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:90:9
2018-08-08 07:28:26 -05:00
|
2019-03-09 06:03:44 -06:00
LL | break;
| ^^^^^
| |
| expected integer, found `()`
| help: give it a value of the expected type: `break value`
2018-08-08 07:28:26 -05:00
error: aborting due to 17 previous errors; 1 warning emitted
2018-08-08 07:28:26 -05:00
Some errors have detailed explanations: E0308, E0425, E0571.
2018-08-08 07:28:26 -05:00
For more information about an error, try `rustc --explain E0308`.