]> git.lizzy.rs Git - rust.git/blob - tests/ui/let-else/let-else-non-diverging.stderr
Don't resolve type var roots in point_at_expr_source_of_inferred_type
[rust.git] / tests / ui / let-else / let-else-non-diverging.stderr
1 error[E0308]: `else` clause of `let...else` does not diverge
2   --> $DIR/let-else-non-diverging.rs:2:32
3    |
4 LL |       let Some(x) = Some(1) else {
5    |  ________________________________^
6 LL | |         Some(2)
7 LL | |     };
8    | |_____^ expected `!`, found enum `Option`
9    |
10    = note: expected type `!`
11               found enum `Option<{integer}>`
12    = help: try adding a diverging expression, such as `return` or `panic!(..)`
13    = help: ...or use `match` instead of `let...else`
14
15 error[E0308]: `else` clause of `let...else` does not diverge
16   --> $DIR/let-else-non-diverging.rs:5:32
17    |
18 LL |       let Some(x) = Some(1) else {
19    |  ________________________________^
20 LL | |         if 1 == 1 {
21 LL | |             panic!();
22 LL | |         }
23 LL | |     };
24    | |_____^ expected `!`, found `()`
25    |
26    = note:   expected type `!`
27            found unit type `()`
28    = help: try adding a diverging expression, such as `return` or `panic!(..)`
29    = help: ...or use `match` instead of `let...else`
30
31 error[E0308]: `else` clause of `let...else` does not diverge
32   --> $DIR/let-else-non-diverging.rs:10:32
33    |
34 LL |     let Some(x) = Some(1) else { Some(2) };
35    |                                ^^^^^^^^^^^ expected `!`, found enum `Option`
36    |
37    = note: expected type `!`
38               found enum `Option<{integer}>`
39    = help: try adding a diverging expression, such as `return` or `panic!(..)`
40    = help: ...or use `match` instead of `let...else`
41
42 error[E0308]: `else` clause of `let...else` does not diverge
43   --> $DIR/let-else-non-diverging.rs:15:32
44    |
45 LL |     let Some(x) = Some(1) else { foo::<Uninhabited>() };
46    |                                ^^^^^^^^^^^^^^^^^^^^^^^^ expected `!`, found enum `Uninhabited`
47    |
48    = note: expected type `!`
49               found enum `Uninhabited`
50    = help: try adding a diverging expression, such as `return` or `panic!(..)`
51    = help: ...or use `match` instead of `let...else`
52
53 error: aborting due to 4 previous errors
54
55 For more information about this error, try `rustc --explain E0308`.