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:
Kevin Ballard
2014-08-25 14:55:00 -07:00
committed by Jakub Wieczorek
parent 1bc407fb84
commit 976438f78f
20 changed files with 115 additions and 23 deletions

View File

@@ -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,