fork/rust

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

borsAuto merge of #69854 - pietroalbini:stable-next, r=Centrilb8cedc00407

1.42.0
1.4 KiB48 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
20error[E0308]: mismatched types
21  --> $DIR/issue-27042.rs:8:9
22   |
23LL |       let _: i32 =
24   |              --- expected due to this
25LL | /         'b:
26LL | |
27LL | |         while true { break }; // but here we cite the whole loop
28   | |____________________________^ expected `i32`, found `()`
29
30error[E0308]: mismatched types
31  --> $DIR/issue-27042.rs:12:9
32   |
33LL | /         'c:
34LL | |         for _ in None { break }; // but here we cite the whole loop
35   | |_______________________________^ expected `i32`, found `()`
36
37error[E0308]: mismatched types
38  --> $DIR/issue-27042.rs:15:9
39   |
40LL |       let _: i32 =
41   |              --- expected due to this
42LL | /         'd:
43LL | |         while let Some(_) = None { break };
44   | |__________________________________________^ expected `i32`, found `()`
45
46error: aborting due to 4 previous errors
47
48For more information about this error, try `rustc --explain E0308`.