summaryrefslogtreecommitdiffstats
path: root/tests/ui/let-else/let-else-non-diverging.stderr
blob: 661d905cd0783551ebd4de7306f6ebfc383d3c68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
error[E0308]: `else` clause of `let...else` does not diverge
  --> $DIR/let-else-non-diverging.rs:2:32
   |
LL |       let Some(x) = Some(1) else {
   |  ________________________________^
LL | |         Some(2)
LL | |     };
   | |_____^ expected `!`, found `Option<{integer}>`
   |
   = note: expected type `!`
              found enum `Option<{integer}>`
   = help: try adding a diverging expression, such as `return` or `panic!(..)`
   = help: ...or use `match` instead of `let...else`

error[E0308]: `else` clause of `let...else` does not diverge
  --> $DIR/let-else-non-diverging.rs:5:32
   |
LL |       let Some(x) = Some(1) else {
   |  ________________________________^
LL | |         if 1 == 1 {
LL | |             panic!();
LL | |         }
LL | |     };
   | |_____^ expected `!`, found `()`
   |
   = note:   expected type `!`
           found unit type `()`
   = help: try adding a diverging expression, such as `return` or `panic!(..)`
   = help: ...or use `match` instead of `let...else`

error[E0308]: `else` clause of `let...else` does not diverge
  --> $DIR/let-else-non-diverging.rs:10:32
   |
LL |     let Some(x) = Some(1) else { Some(2) };
   |                                ^^^^^^^^^^^ expected `!`, found `Option<{integer}>`
   |
   = note: expected type `!`
              found enum `Option<{integer}>`
   = help: try adding a diverging expression, such as `return` or `panic!(..)`
   = help: ...or use `match` instead of `let...else`

error[E0308]: `else` clause of `let...else` does not diverge
  --> $DIR/let-else-non-diverging.rs:15:32
   |
LL |     let Some(x) = Some(1) else { foo::<Uninhabited>() };
   |                                ^^^^^^^^^^^^^^^^^^^^^^^^ expected `!`, found `Uninhabited`
   |
   = note: expected type `!`
              found enum `Uninhabited`
   = help: try adding a diverging expression, such as `return` or `panic!(..)`
   = help: ...or use `match` instead of `let...else`

error: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0308`.