Skip to content

Commit 2b1e273

Browse files
dsprenkelsManishearth
authored andcommitted
Update qquote.rs test case and make unexpected let error fatal
1 parent 79f2cff commit 2b1e273

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/libsyntax/parse/parser.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2134,12 +2134,6 @@ impl<'a> Parser<'a> {
21342134
}
21352135
hi = self.last_span.hi;
21362136
}
2137-
_ if self.token.is_keyword(keywords::Let) => {
2138-
// Catch this syntax error here, instead of in `check_strict_keywords`, so that
2139-
// we can explicitly mention that let is not to be used as an expression
2140-
let msg = "`let` is not an expression, so it cannot be used in this way";
2141-
return Err(self.diagnostic().struct_span_err(self.span, &msg));
2142-
},
21432137
_ => {
21442138
if self.eat_lt() {
21452139
let (qself, path) =
@@ -2162,6 +2156,12 @@ impl<'a> Parser<'a> {
21622156
let lo = self.last_span.lo;
21632157
return self.parse_while_expr(None, lo, attrs);
21642158
}
2159+
if self.token.is_keyword(keywords::Let) {
2160+
// Catch this syntax error here, instead of in `check_strict_keywords`, so
2161+
// that we can explicitly mention that let is not to be used as an expression
2162+
let msg = "`let` is not an expression, so it cannot be used in this way";
2163+
self.span_err(self.span, msg);
2164+
}
21652165
if self.token.is_lifetime() {
21662166
let lifetime = self.get_lifetime();
21672167
let lo = self.span.lo;

src/test/run-fail-fulldeps/qquote.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// ignore-cross-compile
1212

13-
// error-pattern:expected identifier, found keyword `let`
13+
// error-pattern:`let` is not an expression, so it cannot be used in this way
1414

1515
#![feature(quote, rustc_private)]
1616

0 commit comments

Comments
 (0)