rust/tests/ui/let-else/let-else-non-diverging.stderr

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

56 lines
2.0 KiB
Plaintext
Raw Normal View History

2021-08-01 19:18:50 -05:00
error[E0308]: `else` clause of `let...else` does not diverge
--> $DIR/let-else-non-diverging.rs:2: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:5:32
2021-08-01 19:18:50 -05:00
|
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
--> $DIR/let-else-non-diverging.rs:10: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[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 enum `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
2021-08-01 19:18:50 -05:00
For more information about this error, try `rustc --explain E0308`.