Skip to content

Commit a29ca42

Browse files
dsprenkelsManishearth
authored andcommitted
---
yaml --- r: 274269 b: refs/heads/stable c: 79f2cff h: refs/heads/master i: 274267: 1c5fd93
1 parent 9d8ec7f commit a29ca42

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-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: 082c03b0780b2de24b68be04e96d1596a7c5b3cf
32+
refs/heads/stable: 79f2cff44ec62cf42f6c97d28dc4286de683b1e5
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: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2134,6 +2134,12 @@ 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+
},
21372143
_ => {
21382144
if self.eat_lt() {
21392145
let (qself, path) =
@@ -2199,12 +2205,6 @@ impl<'a> Parser<'a> {
21992205
UnsafeBlock(ast::UserProvided),
22002206
attrs);
22012207
}
2202-
if self.eat_keyword(keywords::Let) {
2203-
return Err(self.span_fatal(self.span,
2204-
"`let` is not an expression, so it cannot \
2205-
be used in this way"))
2206-
2207-
}
22082208
if self.eat_keyword(keywords::Return) {
22092209
if self.token.can_begin_expr() {
22102210
let e = try!(self.parse_expr());

0 commit comments

Comments
 (0)