rust/src/test/ui/let-else/let-else-non-diverging.stderr

45 lines
1.5 KiB
Plaintext
Raw Normal View History

2021-08-01 19:18:50 -05:00
error[E0308]: `else` clause of `let...else` does not diverge
2022-06-02 09:39:47 -05:00
--> $DIR/let-else-non-diverging.rs:4:32
2021-08-01 19:18:50 -05:00
|
2022-06-02 09:39:47 -05:00
LL | let Some(x) = Some(1) else {
| ________________________________^
LL | | Some(2)
LL | | };
| |_____^ expected `!`, found enum `Option`
2021-08-01 19:18:50 -05:00
|
= note: expected type `!`
2022-04-17 14:00:32 -05:00
found enum `Option<{integer}>`
2021-08-01 19:18:50 -05:00
= 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:7:32
|
LL | let Some(x) = Some(1) else {
| ________________________________^
LL | | if 1 == 1 {
LL | | panic!();
LL | | }
LL | | };
| |_____^ expected `!`, found `()`
|
2022-04-17 14:00:32 -05:00
= note: expected type `!`
found unit type `()`
2021-08-01 19:18:50 -05:00
= 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
2022-06-02 09:39:47 -05:00
--> $DIR/let-else-non-diverging.rs:12:32
2021-08-01 19:18:50 -05:00
|
2022-06-02 09:39:47 -05:00
LL | let Some(x) = Some(1) else { Some(2) };
| ^^^^^^^^^^^ expected `!`, found enum `Option`
2021-08-01 19:18:50 -05:00
|
= note: expected type `!`
2022-04-17 14:00:32 -05:00
found enum `Option<{integer}>`
2021-08-01 19:18:50 -05:00
= help: try adding a diverging expression, such as `return` or `panic!(..)`
= help: ...or use `match` instead of `let...else`
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0308`.