diff options
| author | Fabian Zaiser <fabian.zaiser@gmail.com> | 2020-11-11 13:15:15 +0000 |
|---|---|---|
| committer | Fabian Zaiser <fabian.zaiser@gmail.com> | 2020-11-14 13:53:12 +0000 |
| commit | 8cf35643106bba09b5d6c71ceac74dc58573f371 (patch) | |
| tree | 3d4cbfbfb737a9092150e94b7fa92713910365f7 /compiler/rustc_parse/src/parser/expr.rs | |
| parent | a38f8fb674e6a0a6fc358655c6ce6069235f621a (diff) | |
| download | rust-8cf35643106bba09b5d6c71ceac74dc58573f371.tar.gz rust-8cf35643106bba09b5d6c71ceac74dc58573f371.zip | |
Add underscore expressions for destructuring assignments
Co-authored-by: varkor <github@varkor.com>
Diffstat (limited to 'compiler/rustc_parse/src/parser/expr.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/expr.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index 188bf227c42..ffbf786491d 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -1089,6 +1089,9 @@ impl<'a> Parser<'a> { self.parse_yield_expr(attrs) } else if self.eat_keyword(kw::Let) { self.parse_let_expr(attrs) + } else if self.eat_keyword(kw::Underscore) { + self.sess.gated_spans.gate(sym::destructuring_assignment, self.prev_token.span); + Ok(self.mk_expr(self.prev_token.span, ExprKind::Underscore, attrs)) } else if !self.unclosed_delims.is_empty() && self.check(&token::Semi) { // Don't complain about bare semicolons after unclosed braces // recovery in order to keep the error count down. Fixing the |
