diff options
| author | Daan Sprenkels <dsprenkels@gmail.com> | 2016-01-14 16:52:24 +0100 |
|---|---|---|
| committer | Manish Goregaokar <manishsmail@gmail.com> | 2016-01-25 20:56:13 +0530 |
| commit | 1745153eaeeb0793876b36422bda6764483ceefb (patch) | |
| tree | a43c7c72bc25db192ee35cf8fed7b29772b7ddb0 /src | |
| parent | 2b1e2732930830fc295d26bfb4bb29931e7e84ac (diff) | |
| download | rust-1745153eaeeb0793876b36422bda6764483ceefb.tar.gz rust-1745153eaeeb0793876b36422bda6764483ceefb.zip | |
do not additionally note about unexpected identifier after unexpected let
error, by moving unexpected let check into the proper if-else clause
Diffstat (limited to 'src')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index c071670ea6e..daa13885e0d 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -2156,12 +2156,6 @@ impl<'a> Parser<'a> { let lo = self.last_span.lo; return self.parse_while_expr(None, lo, attrs); } - if self.token.is_keyword(keywords::Let) { - // Catch this syntax error here, instead of in `check_strict_keywords`, so - // that we can explicitly mention that let is not to be used as an expression - let msg = "`let` is not an expression, so it cannot be used in this way"; - self.span_err(self.span, msg); - } if self.token.is_lifetime() { let lifetime = self.get_lifetime(); let lo = self.span.lo; @@ -2224,6 +2218,11 @@ impl<'a> Parser<'a> { ex = ExprBreak(None); } hi = self.last_span.hi; + } else if self.token.is_keyword(keywords::Let) { + // Catch this syntax error here, instead of in `check_strict_keywords`, so + // that we can explicitly mention that let is not to be used as an expression + let msg = "`let` is not an expression, so it cannot be used in this way"; + return Err(self.fatal(&msg)); } else if self.check(&token::ModSep) || self.token.is_ident() && !self.check_keyword(keywords::True) && |
