|
| 1 | +error[E0308]: `else` clause of `let...else` does not diverge |
| 2 | + --> $DIR/let-else-non-diverging.rs:12:32 |
| 3 | + | |
| 4 | +LL | let Some(x) = Some(1) else { Some(2) }; |
| 5 | + | ^^^^^^^^^^^ expected `!`, found enum `Option` |
| 6 | + | |
| 7 | + = note: expected type `!` |
| 8 | + found type `Option<{integer}>` |
| 9 | + = help: try adding a diverging expression, such as `return` or `panic!(..)` |
| 10 | + = help: ...or use `match` instead of `let...else` |
| 11 | + |
| 12 | +error[E0308]: `else` clause of `let...else` does not diverge |
| 13 | + --> $DIR/let-else-non-diverging.rs:7:32 |
| 14 | + | |
| 15 | +LL | let Some(x) = Some(1) else { |
| 16 | + | ________________________________^ |
| 17 | +LL | | if 1 == 1 { |
| 18 | +LL | | panic!(); |
| 19 | +LL | | } |
| 20 | +LL | | }; |
| 21 | + | |_____^ expected `!`, found `()` |
| 22 | + | |
| 23 | + = note: expected type `!` |
| 24 | + found type `()` |
| 25 | + = help: try adding a diverging expression, such as `return` or `panic!(..)` |
| 26 | + = help: ...or use `match` instead of `let...else` |
| 27 | + |
| 28 | +error[E0308]: `else` clause of `let...else` does not diverge |
| 29 | + --> $DIR/let-else-non-diverging.rs:4:32 |
| 30 | + | |
| 31 | +LL | let Some(x) = Some(1) else { |
| 32 | + | ________________________________^ |
| 33 | +LL | | Some(2) |
| 34 | +LL | | }; |
| 35 | + | |_____^ expected `!`, found enum `Option` |
| 36 | + | |
| 37 | + = note: expected type `!` |
| 38 | + found type `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: aborting due to 3 previous errors |
| 43 | + |
| 44 | +For more information about this error, try `rustc --explain E0308`. |
0 commit comments