1
Fork 0

Rollup merge of #114819 - estebank:issue-78124, r=compiler-errors

Point at return type when it influences non-first `match` arm

When encountering code like

```rust
fn foo() -> i32 {
    match 0 {
        1 => return 0,
        2 => "",
        _ => 1,
    }
}
```

Point at the return type and not at the prior arm, as that arm has type `!` which isn't influencing the arm corresponding to arm `2`.

Fix #78124.
This commit is contained in:
Matthias Krüger 2023-08-15 20:34:25 +02:00 committed by GitHub
commit 8db5a6d8ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
38 changed files with 157 additions and 73 deletions

View file

@ -2700,7 +2700,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
| ObligationCauseCode::MatchImpl(..)
| ObligationCauseCode::ReturnType
| ObligationCauseCode::ReturnValue(_)
| ObligationCauseCode::BlockTailExpression(_)
| ObligationCauseCode::BlockTailExpression(..)
| ObligationCauseCode::AwaitableExpr(_)
| ObligationCauseCode::ForLoopIterator
| ObligationCauseCode::QuestionMark