about summary refs log tree commit diff
path: root/compiler/rustc_codegen_gcc/example/subslice-patterns-const-eval.rs
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2025-01-17 09:11:18 +0100
committerGitHub <noreply@github.com>2025-01-17 09:11:18 +0100
commitc43893005e5e31663366c478e48c4e236f7d0587 (patch)
treea205e8fbdceb2ee7992988f7d97edf3224df6953 /compiler/rustc_codegen_gcc/example/subslice-patterns-const-eval.rs
parentdbdfa7914c07ee37857302a46c6b8bd797e33ff5 (diff)
parentf78a1bd89ade0d326a47222e51c61bd631530416 (diff)
downloadrust-c43893005e5e31663366c478e48c4e236f7d0587.tar.gz
rust-c43893005e5e31663366c478e48c4e236f7d0587.zip
Rollup merge of #135558 - estebank:issue-133316, r=chenyukang
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