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:
commit
8db5a6d8ee
38 changed files with 157 additions and 73 deletions
|
@ -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) => &[],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue