Rollup merge of #31211 - Manishearth:pr-30765, r=nrc

r? @eddyb or @nrc
This commit is contained in:
Manish Goregaokar
2016-01-26 18:55:39 +05:30
3 changed files with 9 additions and 3 deletions

View File

@@ -2218,6 +2218,12 @@ 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 mut db = self.fatal("expected expression, found statement (`let`)");
db.note("variable declaration using `let` is a statement");
return Err(db);
} else if self.check(&token::ModSep) ||
self.token.is_ident() &&
!self.check_keyword(keywords::True) &&