2019-06-21 23:30:24 +00:00
|
|
|
warning: denote infinite loops with `loop { ... }`
|
|
|
|
--> $DIR/issue-27042.rs:8:9
|
|
|
|
|
|
|
|
|
LL | / 'b:
|
|
|
|
LL | |
|
|
|
|
LL | | while true { break }; // but here we cite the whole loop
|
2021-01-19 23:51:51 +00:00
|
|
|
| |__________________^ help: use `loop`
|
2019-06-21 23:30:24 +00:00
|
|
|
|
|
2019-07-16 20:17:38 +00:00
|
|
|
= note: `#[warn(while_true)]` on by default
|
2019-06-21 23:30:24 +00:00
|
|
|
|
2018-07-15 21:11:54 +00:00
|
|
|
error[E0308]: mismatched types
|
2018-12-25 15:56:47 +00:00
|
|
|
--> $DIR/issue-27042.rs:6:16
|
2018-07-15 21:11:54 +00:00
|
|
|
|
|
2023-09-26 23:46:10 +00:00
|
|
|
LL | let _: i32 =
|
|
|
|
| - expected because of this assignment
|
|
|
|
LL | 'a: // in this case, the citation is just the `break`:
|
2019-03-09 12:03:44 +00:00
|
|
|
LL | loop { break };
|
2023-09-26 23:46:10 +00:00
|
|
|
| ---- ^^^^^ expected `i32`, found `()`
|
|
|
|
| |
|
|
|
|
| this loop is expected to be of type `i32`
|
2023-09-25 22:10:08 +00:00
|
|
|
|
|
2024-04-09 23:37:01 +00:00
|
|
|
help: give the `break` a value of the expected type
|
2023-09-25 22:10:08 +00:00
|
|
|
|
|
|
|
|
LL | loop { break 42 };
|
|
|
|
| ++
|
2018-07-15 21:11:54 +00:00
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
2018-12-25 15:56:47 +00:00
|
|
|
--> $DIR/issue-27042.rs:8:9
|
2018-07-15 21:11:54 +00:00
|
|
|
|
|
2019-11-19 05:00:24 +00:00
|
|
|
LL | let _: i32 =
|
|
|
|
| --- expected due to this
|
2019-03-09 12:03:44 +00:00
|
|
|
LL | / 'b:
|
2019-06-21 23:30:24 +00:00
|
|
|
LL | |
|
2018-07-15 21:11:54 +00:00
|
|
|
LL | | while true { break }; // but here we cite the whole loop
|
2019-11-15 17:37:01 +00:00
|
|
|
| |____________________________^ expected `i32`, found `()`
|
2018-07-15 21:11:54 +00:00
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
2019-06-21 23:30:24 +00:00
|
|
|
--> $DIR/issue-27042.rs:12:9
|
2018-07-15 21:11:54 +00:00
|
|
|
|
|
2019-03-09 12:03:44 +00:00
|
|
|
LL | / 'c:
|
2018-07-15 21:11:54 +00:00
|
|
|
LL | | for _ in None { break }; // but here we cite the whole loop
|
2019-11-15 17:37:01 +00:00
|
|
|
| |_______________________________^ expected `i32`, found `()`
|
2024-04-19 13:00:28 +00:00
|
|
|
|
|
|
|
|
= note: `for` loops evaluate to unit type `()`
|
2018-07-15 21:11:54 +00:00
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
2019-06-21 23:30:24 +00:00
|
|
|
--> $DIR/issue-27042.rs:15:9
|
2018-07-15 21:11:54 +00:00
|
|
|
|
|
2019-11-19 05:00:24 +00:00
|
|
|
LL | let _: i32 =
|
|
|
|
| --- expected due to this
|
2019-03-09 12:03:44 +00:00
|
|
|
LL | / 'd:
|
2018-07-15 21:11:54 +00:00
|
|
|
LL | | while let Some(_) = None { break };
|
2019-11-15 17:37:01 +00:00
|
|
|
| |__________________________________________^ expected `i32`, found `()`
|
2018-07-15 21:11:54 +00:00
|
|
|
|
2020-03-11 15:30:09 +00:00
|
|
|
error: aborting due to 4 previous errors; 1 warning emitted
|
2018-07-15 21:11:54 +00:00
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0308`.
|