diff options
| author | Kevin Butler <haqkrs@gmail.com> | 2015-10-25 01:02:08 +0100 |
|---|---|---|
| committer | Kevin Butler <haqkrs@gmail.com> | 2015-10-25 01:33:22 +0100 |
| commit | 998914f5da91bd6e07a0bdf45612dcd446e6fa94 (patch) | |
| tree | 35b80be6000a24e95a5a6577637edc12bd818a0d /src/libsyntax | |
| parent | 64da379c8c6c967a451817dc4909eeb0055351e7 (diff) | |
| download | rust-998914f5da91bd6e07a0bdf45612dcd446e6fa94.tar.gz rust-998914f5da91bd6e07a0bdf45612dcd446e6fa94.zip | |
libsyntax: remove panics from Parser::parse_pat_nopanic
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 092013a4753..7bc9441fb9d 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -3276,12 +3276,9 @@ impl<'a> Parser<'a> { } token::OpenDelim(token::Brace) => { if qself.is_some() { - let span = self.span; - self.span_err(span, - "unexpected `{` after qualified path"); - self.abort_if_errors(); + return Err(self.fatal("unexpected `{` after qualified path")); } - // Parse struct pattern + // Parse struct pattern try!(self.bump()); let (fields, etc) = try!(self.parse_pat_fields()); try!(self.bump()); @@ -3289,10 +3286,7 @@ impl<'a> Parser<'a> { } token::OpenDelim(token::Paren) => { if qself.is_some() { - let span = self.span; - self.span_err(span, - "unexpected `(` after qualified path"); - self.abort_if_errors(); + return Err(self.fatal("unexpected `(` after qualified path")); } // Parse tuple struct or enum pattern if self.look_ahead(1, |t| *t == token::DotDot) { |
