Produce a better error for irrefutable if let patterns
Modify ast::ExprMatch to include a new value of type ast::MatchSource, making it easy to tell whether the match was written literally or produced via desugaring. This allows us to customize error messages appropriately.
This commit is contained in:
committed by
Jakub Wieczorek
parent
1bc407fb84
commit
976438f78f
@@ -1226,9 +1226,10 @@ pub fn noop_fold_expr<T: Folder>(Expr {id, node, span}: Expr, folder: &mut T) ->
|
||||
ExprLoop(folder.fold_block(body),
|
||||
opt_ident.map(|i| folder.fold_ident(i)))
|
||||
}
|
||||
ExprMatch(expr, arms) => {
|
||||
ExprMatch(expr, arms, source) => {
|
||||
ExprMatch(folder.fold_expr(expr),
|
||||
arms.move_map(|x| folder.fold_arm(x)))
|
||||
arms.move_map(|x| folder.fold_arm(x)),
|
||||
source)
|
||||
}
|
||||
ExprFnBlock(capture_clause, decl, body) => {
|
||||
ExprFnBlock(capture_clause,
|
||||
|
||||
Reference in New Issue
Block a user