fork/rust

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

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
1.6 KiB55 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 |     let _: i32 =
15   |         - expected because of this assignment
16LL |         'a: // in this case, the citation is just the `break`:
17LL |         loop { break };
18   |         ----   ^^^^^ expected `i32`, found `()`
19   |         |
20   |         this loop is expected to be of type `i32`
21   |
22help: give it a value of the expected type
23   |
24LL |         loop { break 42 };
25   |                      ++
26
27error[E0308]: mismatched types
28  --> $DIR/issue-27042.rs:8:9
29   |
30LL |       let _: i32 =
31   |              --- expected due to this
32LL | /         'b:
33LL | |
34LL | |         while true { break }; // but here we cite the whole loop
35   | |____________________________^ expected `i32`, found `()`
36
37error[E0308]: mismatched types
38  --> $DIR/issue-27042.rs:12:9
39   |
40LL | /         'c:
41LL | |         for _ in None { break }; // but here we cite the whole loop
42   | |_______________________________^ expected `i32`, found `()`
43
44error[E0308]: mismatched types
45  --> $DIR/issue-27042.rs:15:9
46   |
47LL |       let _: i32 =
48   |              --- expected due to this
49LL | /         'd:
50LL | |         while let Some(_) = None { break };
51   | |__________________________________________^ expected `i32`, found `()`
52
53error: aborting due to 4 previous errors; 1 warning emitted
54
55For more information about this error, try `rustc --explain E0308`.