diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2025-01-15 22:09:52 +0000 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2025-01-16 00:18:26 +0000 |
| commit | f78a1bd89ade0d326a47222e51c61bd631530416 (patch) | |
| tree | d1afd704eb56cec7a80aa6f6d4569bfd1ad56f0d /compiler/rustc_codegen_gcc/example/subslice-patterns-const-eval.rs | |
| parent | 27f336106db859435f6edcf507e38f90b1e2af43 (diff) | |
| download | rust-f78a1bd89ade0d326a47222e51c61bd631530416.tar.gz rust-f78a1bd89ade0d326a47222e51c61bd631530416.zip | |
Detect if-else chains with a missing final else in type errors
```
error[E0308]: `if` and `else` have incompatible types
--> $DIR/if-else-chain-missing-else.rs:12:12
|
LL | let x = if let Ok(x) = res {
| ______________-
LL | | x
| | - expected because of this
LL | | } else if let Err(e) = res {
| | ____________^
LL | || return Err(e);
LL | || };
| || ^
| ||_____|
| |_____`if` and `else` have incompatible types
| expected `i32`, found `()`
|
= note: `if` expressions without `else` evaluate to `()`
= note: consider adding an `else` block that evaluates to the expected type
```
We probably want a longer explanation and fewer spans on this case.
Partially address #133316.
Diffstat (limited to 'compiler/rustc_codegen_gcc/example/subslice-patterns-const-eval.rs')
0 files changed, 0 insertions, 0 deletions
