diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-08-15 20:34:25 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-08-15 20:34:25 +0200 |
| commit | 8db5a6d8ee36e4a2d745fd356e7af09809b72d34 (patch) | |
| tree | 2af5919b13396c09796ac96d08c0690cdb5b147a /compiler/rustc_passes/src/check_const.rs | |
| parent | 5baf2a110fb699a1dc6c8036fd7dedbf746c54ca (diff) | |
| parent | 58aa903848028ede4c8ccd584cb67f3780b082e9 (diff) | |
| download | rust-8db5a6d8ee36e4a2d745fd356e7af09809b72d34.tar.gz rust-8db5a6d8ee36e4a2d745fd356e7af09809b72d34.zip | |
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.
Diffstat (limited to 'compiler/rustc_passes/src/check_const.rs')
| -rw-r--r-- | compiler/rustc_passes/src/check_const.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_passes/src/check_const.rs b/compiler/rustc_passes/src/check_const.rs index 495eb615ed8..8437e9a40e2 100644 --- a/compiler/rustc_passes/src/check_const.rs +++ b/compiler/rustc_passes/src/check_const.rs @@ -45,7 +45,7 @@ impl NonConstExpr { Self::Loop(ForLoop) | Self::Match(ForLoopDesugar) => &[sym::const_for], - Self::Match(TryDesugar) => &[sym::const_try], + Self::Match(TryDesugar(_)) => &[sym::const_try], // All other expressions are allowed. Self::Loop(Loop | While) | Self::Match(Normal | FormatArgs) => &[], |
