1
Fork 0

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

@ -845,7 +845,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
}
fn expr_match(&self, span: Span, arg: P<ast::Expr>, arms: Vec<ast::Arm>) -> P<Expr> {
self.expr(span, ast::ExprMatch(arg, arms))
self.expr(span, ast::ExprMatch(arg, arms, ast::MatchNormal))
}
fn expr_if(&self, span: Span, cond: P<ast::Expr>,