Update qquote.rs test case and make unexpected let
error fatal
This commit is contained in:
parent
79f2cff44e
commit
2b1e273293
2 changed files with 7 additions and 7 deletions
|
@ -2134,12 +2134,6 @@ impl<'a> Parser<'a> {
|
||||||
}
|
}
|
||||||
hi = self.last_span.hi;
|
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() {
|
if self.eat_lt() {
|
||||||
let (qself, path) =
|
let (qself, path) =
|
||||||
|
@ -2162,6 +2156,12 @@ impl<'a> Parser<'a> {
|
||||||
let lo = self.last_span.lo;
|
let lo = self.last_span.lo;
|
||||||
return self.parse_while_expr(None, lo, attrs);
|
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() {
|
if self.token.is_lifetime() {
|
||||||
let lifetime = self.get_lifetime();
|
let lifetime = self.get_lifetime();
|
||||||
let lo = self.span.lo;
|
let lo = self.span.lo;
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
// ignore-cross-compile
|
// ignore-cross-compile
|
||||||
|
|
||||||
// error-pattern:expected identifier, found keyword `let`
|
// error-pattern:`let` is not an expression, so it cannot be used in this way
|
||||||
|
|
||||||
#![feature(quote, rustc_private)]
|
#![feature(quote, rustc_private)]
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue