diff options
| author | Michael Goulet <michael@errs.io> | 2023-11-27 19:06:46 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-27 19:06:46 -0500 |
| commit | 8ff558b8fce007a541684f2adea48fa4339ce8f2 (patch) | |
| tree | 4be4271445808525908e2d7a10c789cba5865f26 /compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp | |
| parent | 1742a9fce6530d4e6637a0d7093e8738335e6e16 (diff) | |
| parent | 8221f9c837f46461d2dd6f29a4468b3a0ee4b508 (diff) | |
| download | rust-8ff558b8fce007a541684f2adea48fa4339ce8f2.tar.gz rust-8ff558b8fce007a541684f2adea48fa4339ce8f2.zip | |
Rollup merge of #117526 - estebank:issue-24157, r=b-naber
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.
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
