Skip to content

Commit dbce758

Browse files
dsprenkelsManishearth
authored andcommitted
---
yaml --- r: 274271 b: refs/heads/stable c: 1745153 h: refs/heads/master i: 274269: a29ca42 274267: 1c5fd93 274263: 55a5bfe 274255: 8e49334 274239: dca8a68
1 parent 690e667 commit dbce758

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: c0221c8897db309a79990367476177b1230bb264
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: 2b1e2732930830fc295d26bfb4bb29931e7e84ac
32+
refs/heads/stable: 1745153eaeeb0793876b36422bda6764483ceefb
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

branches/stable/src/libsyntax/parse/parser.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2156,12 +2156,6 @@ impl<'a> Parser<'a> {
21562156
let lo = self.last_span.lo;
21572157
return self.parse_while_expr(None, lo, attrs);
21582158
}
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-
}
21652159
if self.token.is_lifetime() {
21662160
let lifetime = self.get_lifetime();
21672161
let lo = self.span.lo;
@@ -2224,6 +2218,11 @@ impl<'a> Parser<'a> {
22242218
ex = ExprBreak(None);
22252219
}
22262220
hi = self.last_span.hi;
2221+
} else if self.token.is_keyword(keywords::Let) {
2222+
// Catch this syntax error here, instead of in `check_strict_keywords`, so
2223+
// that we can explicitly mention that let is not to be used as an expression
2224+
let msg = "`let` is not an expression, so it cannot be used in this way";
2225+
return Err(self.fatal(&msg));
22272226
} else if self.check(&token::ModSep) ||
22282227
self.token.is_ident() &&
22292228
!self.check_keyword(keywords::True) &&

0 commit comments

Comments
 (0)