rust/tests/ui/expr
Esteban Küber f78a1bd89a 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.
2025-01-16 00:18:26 +00:00
..
compound-assignment [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
if Detect if-else chains with a missing final else in type errors 2025-01-16 00:18:26 +00:00
malformed_closure Use parenthetical notation for Fn traits 2024-05-29 22:26:54 +00:00
block-fn.rs Move 100 entries from tests/ui into subdirs 2024-05-20 19:55:59 -07:00
block-generic.rs Move 100 entries from tests/ui into subdirs 2024-05-20 19:55:59 -07:00
block.rs Move 100 entries from tests/ui into subdirs 2024-05-20 19:55:59 -07:00
copy.rs Move 100 entries from tests/ui into subdirs 2024-05-20 19:55:59 -07:00
if-bot.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
if-generic.rs Move 100 entries from tests/ui into subdirs 2024-05-20 19:55:59 -07:00
if-panic-all.rs Move 100 entries from tests/ui into subdirs 2024-05-20 19:55:59 -07:00
issue-22933-1.rs Move some tests 2024-04-21 15:43:43 -03:00
issue-22933-2.rs Move some tests 2024-04-21 15:43:43 -03:00
issue-22933-2.stderr More accurate suggestions when writing wrong style of enum variant literal 2024-07-18 18:20:35 +00:00
scope.rs tests: remove //@ pretty-expanded usages 2024-11-26 02:50:48 +08:00