]> git.lizzy.rs Git - rust.git/blob - src/test/ui/break-diverging-value.stderr
Add tests for uninhabited types
[rust.git] / src / test / ui / break-diverging-value.stderr
1 error[E0308]: mismatched types
2   --> $DIR/break-diverging-value.rs:11:26
3    |
4 LL | fn loop_break_break() -> i32 {
5    |    ----------------      ^^^ expected `i32`, found `()`
6    |    |
7    |    implicitly returns `()` as its body has no tail or `return` expression
8
9 error[E0069]: `return;` in a function whose return type is not `()`
10   --> $DIR/break-diverging-value.rs:16:37
11    |
12 LL |     let loop_value = loop { break { return; () } };
13    |                                     ^^^^^^ return type is not `()`
14
15 error[E0308]: mismatched types
16   --> $DIR/break-diverging-value.rs:15:29
17    |
18 LL | fn loop_break_return_2() -> i32 {
19    |    -------------------      ^^^ expected `i32`, found `()`
20    |    |
21    |    implicitly returns `()` as its body has no tail or `return` expression
22
23 error[E0308]: mismatched types
24   --> $DIR/break-diverging-value.rs:26:25
25    |
26 LL | fn loop_break_void() -> i32 {
27    |    ---------------      ^^^ expected `i32`, found `()`
28    |    |
29    |    implicitly returns `()` as its body has no tail or `return` expression
30
31 error: aborting due to 4 previous errors
32
33 Some errors have detailed explanations: E0069, E0308.
34 For more information about an error, try `rustc --explain E0069`.