diff options
| author | Daan Sprenkels <dsprenkels@gmail.com> | 2016-01-06 23:58:45 +0100 |
|---|---|---|
| committer | Manish Goregaokar <manishsmail@gmail.com> | 2016-01-25 20:52:53 +0530 |
| commit | 082c03b0780b2de24b68be04e96d1596a7c5b3cf (patch) | |
| tree | 21feac4bc253129687ae9018886fa87904ac6870 /src/libsyntax/parse | |
| parent | 6866f1361debf5857856ff95eeee806bb7bea738 (diff) | |
| download | rust-082c03b0780b2de24b68be04e96d1596a7c5b3cf.tar.gz rust-082c03b0780b2de24b68be04e96d1596a7c5b3cf.zip | |
libsyntax: note that `let a = (let b = something)` is invalid
in parse_bottom_expr (parser.rs)
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index bfa42e76129..edb1f7eb926 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -2199,6 +2199,12 @@ impl<'a> Parser<'a> { UnsafeBlock(ast::UserProvided), attrs); } + if self.eat_keyword(keywords::Let) { + return Err(self.span_fatal(self.span, + "`let` is not an expression, so it cannot \ + be used in this way")) + + } if self.eat_keyword(keywords::Return) { if self.token.can_begin_expr() { let e = try!(self.parse_expr()); |
