fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #66089 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum4560ea788cb

1.39.0
1.5 KiB56 linesraw
1warning: denote infinite loops with `loop { ... }`
2  --> $DIR/issue-27042.rs:8:9
3   |
4LL | /         'b:
5LL | |
6LL | |         while true { break }; // but here we cite the whole loop
7   | |____________________________^ help: use `loop`
8   |
9   = note: `#[warn(while_true)]` on by default
10
11error[E0308]: mismatched types
12  --> $DIR/issue-27042.rs:6:16
13   |
14LL |         loop { break };
15   |                ^^^^^
16   |                |
17   |                expected i32, found ()
18   |                help: give it a value of the expected type: `break 42`
19   |
20   = note: expected type `i32`
21              found type `()`
22
23error[E0308]: mismatched types
24  --> $DIR/issue-27042.rs:8:9
25   |
26LL | /         'b:
27LL | |
28LL | |         while true { break }; // but here we cite the whole loop
29   | |____________________________^ expected i32, found ()
30   |
31   = note: expected type `i32`
32              found type `()`
33
34error[E0308]: mismatched types
35  --> $DIR/issue-27042.rs:12:9
36   |
37LL | /         'c:
38LL | |         for _ in None { break }; // but here we cite the whole loop
39   | |_______________________________^ expected i32, found ()
40   |
41   = note: expected type `i32`
42              found type `()`
43
44error[E0308]: mismatched types
45  --> $DIR/issue-27042.rs:15:9
46   |
47LL | /         'd:
48LL | |         while let Some(_) = None { break };
49   | |__________________________________________^ expected i32, found ()
50   |
51   = note: expected type `i32`
52              found type `()`
53
54error: aborting due to 4 previous errors
55
56For more information about this error, try `rustc --explain E0308`.