rust/tests/ui/match
Esteban Küber 8221f9c837 Account for ! arm in tail match expr
On functions with a default return type that influences the coerced type
of `match` arms, check if the failing arm is actually of type `!`. If
so, suggest changing the return type so the coercion against the prior
arms is successful.

```
error[E0308]: `match` arms have incompatible types
  --> $DIR/match-tail-expr-never-type-error.rs:9:13
   |
LL |   fn bar(a: bool) {
   |                  - help: try adding a return type: `-> i32`
LL | /     match a {
LL | |         true => 1,
   | |                 - this is found to be of type `{integer}`
LL | |         false => {
LL | |             never()
   | |             ^^^^^^^
   | |             |
   | |             expected integer, found `()`
   | |             this expression is of type `!`, but it get's coerced to `()` due to its surrounding expression
LL | |         }
LL | |     }
   | |_____- `match` arms have incompatible types
```

Fix #24157.
2023-11-27 16:19:02 +00:00
..
auxiliary
const_non_normal_zst_ref_pattern.rs
expr_before_ident_pat.rs
expr_before_ident_pat.stderr
expr-match-panic-fn.rs
expr-match-panic.rs
guards-parenthesized-and.rs
guards.rs
issue-5530.rs
issue-11319.rs
issue-11319.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
issue-11940.rs
issue-12552.rs
issue-12552.stderr
issue-18060.rs
issue-26251.rs
issue-26996.rs
issue-27021.rs
issue-33498.rs
issue-41255.rs
issue-41255.stderr
issue-42679.rs
issue-46920-byte-array-patterns.rs
issue-56685.rs
issue-56685.stderr
issue-70972-dyn-trait.rs
issue-70972-dyn-trait.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
issue-72680.rs
issue-72896-non-partial-eq-const.rs
issue-72896-non-partial-eq-const.stderr
issue-74050-end-span.rs
issue-74050-end-span.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
issue-82392.rs
issue-82392.stdout
issue-82866.rs
issue-82866.stderr
issue-84434.rs
issue-91058.rs
issue-91058.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
issue-92100.rs
issue-92100.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
issue-112438.rs
issue-113012.rs
issue-114691.rs
issue-115681.rs
match_non_exhaustive.rs
match_non_exhaustive.stderr Tweak spans for "adt defined here" note 2023-11-03 18:26:16 +01:00
match-arm-resolving-to-never.rs
match-arm-resolving-to-never.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
match-bot-panic.rs
match-disc-bot.rs
match-fn-call.rs
match-fn-call.stderr
match-ill-type2.rs
match-ill-type2.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
match-incompat-type-semi.rs
match-incompat-type-semi.stderr
match-join.rs
match-join.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
match-no-arms-unreachable-after.rs
match-no-arms-unreachable-after.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
match-on-negative-integer-ranges.rs
match-pattern-field-mismatch-2.rs
match-pattern-field-mismatch-2.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
match-pattern-field-mismatch.rs
match-pattern-field-mismatch.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
match-range-fail-2.rs
match-range-fail-2.stderr Fix range overflow checking 2023-10-11 04:55:55 +02:00
match-range-fail.rs
match-range-fail.stderr
match-ref-mut-invariance.rs
match-ref-mut-invariance.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
match-ref-mut-let-invariance.rs
match-ref-mut-let-invariance.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
match-ref-mut-stability.rs
match-struct.rs
match-struct.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
match-tag-nullary.rs
match-tag-nullary.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
match-tag-unary.rs
match-tag-unary.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
match-tail-expr-never-type-error.rs Account for ! arm in tail match expr 2023-11-27 16:19:02 +00:00
match-tail-expr-never-type-error.stderr Account for ! arm in tail match expr 2023-11-27 16:19:02 +00:00
match-type-err-first-arm.rs
match-type-err-first-arm.stderr
match-unresolved-one-arm.rs
match-unresolved-one-arm.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
match-vec-mismatch-2.rs
match-vec-mismatch-2.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
match-wildcards.rs
non-first-arm-doesnt-match-expected-return-type.rs
non-first-arm-doesnt-match-expected-return-type.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
pattern-deref-miscompile.rs
single-line.rs
single-line.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
validate-range-endpoints.rs Fix range overflow checking 2023-10-11 04:55:55 +02:00
validate-range-endpoints.stderr Fix range overflow checking 2023-10-11 04:55:55 +02:00