Skip to content

Commit 082c03b

Browse files
dsprenkelsManishearth
authored andcommitted
libsyntax: note that let a = (let b = something) is invalid
in parse_bottom_expr (parser.rs)
1 parent 6866f13 commit 082c03b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/libsyntax/parse/parser.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2199,6 +2199,12 @@ impl<'a> Parser<'a> {
21992199
UnsafeBlock(ast::UserProvided),
22002200
attrs);
22012201
}
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+
}
22022208
if self.eat_keyword(keywords::Return) {
22032209
if self.token.can_begin_expr() {
22042210
let e = try!(self.parse_expr());

0 commit comments

Comments
 (0)