about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorDaan Sprenkels <dsprenkels@gmail.com>2016-01-14 16:04:35 +0100
committerManish Goregaokar <manishsmail@gmail.com>2016-01-25 20:56:12 +0530
commit2b1e2732930830fc295d26bfb4bb29931e7e84ac (patch)
tree6f9614782baba784c3b08fd6392884a995bcb3da /src/libsyntax/parse
parent79f2cff44ec62cf42f6c97d28dc4286de683b1e5 (diff)
downloadrust-2b1e2732930830fc295d26bfb4bb29931e7e84ac.tar.gz
rust-2b1e2732930830fc295d26bfb4bb29931e7e84ac.zip
Update qquote.rs test case and make unexpected `let` error fatal
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/parser.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index f3809455fe0..c071670ea6e 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -2134,12 +2134,6 @@ impl<'a> Parser<'a> {
                 }
                 hi = self.last_span.hi;
             }
-            _ 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.diagnostic().struct_span_err(self.span, &msg));
-            },
             _ => {
                 if self.eat_lt() {
                     let (qself, path) =
@@ -2162,6 +2156,12 @@ 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;