diff options
| author | Kevin Ballard <kevin@sb.org> | 2014-08-25 14:55:00 -0700 |
|---|---|---|
| committer | Jakub Wieczorek <jakub@jakub.cc> | 2014-09-30 18:54:02 +0200 |
| commit | 976438f78fdce8092430f4c81ca272293c48f1a0 (patch) | |
| tree | 69c6449d655bf964fcaeda704d6058a35d06ca80 /src/libsyntax/parse/parser.rs | |
| parent | 1bc407fb8413b6e7f05a9d38b0d0a770e67dde5a (diff) | |
| download | rust-976438f78fdce8092430f4c81ca272293c48f1a0.tar.gz rust-976438f78fdce8092430f4c81ca272293c48f1a0.zip | |
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.
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index d4ba81c737b..ccb398bf2fb 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -38,7 +38,7 @@ use ast::{ItemMac, ItemMod, ItemStruct, ItemTrait, ItemTy}; use ast::{LifetimeDef, Lit, Lit_}; use ast::{LitBool, LitChar, LitByte, LitBinary}; use ast::{LitNil, LitStr, LitInt, Local, LocalLet}; -use ast::{MutImmutable, MutMutable, Mac_, MacInvocTT, Matcher, MatchNonterminal}; +use ast::{MutImmutable, MutMutable, Mac_, MacInvocTT, Matcher, MatchNonterminal, MatchNormal}; use ast::{MatchSeq, MatchTok, Method, MutTy, BiMul, Mutability}; use ast::{MethodImplItem, NamedField, UnNeg, NoReturn, UnNot}; use ast::{Pat, PatEnum, PatIdent, PatLit, PatRange, PatRegion, PatStruct}; @@ -2973,7 +2973,7 @@ impl<'a> Parser<'a> { } let hi = self.span.hi; self.bump(); - return self.mk_expr(lo, hi, ExprMatch(discriminant, arms)); + return self.mk_expr(lo, hi, ExprMatch(discriminant, arms, MatchNormal)); } pub fn parse_arm(&mut self) -> Arm { |
