diff options
| author | Pietro Albini <pietro@pietroalbini.org> | 2019-08-01 16:00:26 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-08-01 16:00:26 +0200 |
| commit | 810ffe2ba07320cac7b89af0c2a68048bfb779c9 (patch) | |
| tree | 41f7ef742d5d0a7cb4bbed18d3b566c7ee497981 /src/libsyntax/parse/parser.rs | |
| parent | e2934bab3ea0e1cdcd15e215629ba0ea17507449 (diff) | |
| parent | 6551285ccaf1562eb73ca1013730165b4d415d8e (diff) | |
| download | rust-810ffe2ba07320cac7b89af0c2a68048bfb779c9.tar.gz rust-810ffe2ba07320cac7b89af0c2a68048bfb779c9.zip | |
Rollup merge of #63122 - Centril:fix-63115, r=petrochenkov
Account for `maybe_whole_expr` in range patterns Fixes https://github.com/rust-lang/rust/issues/63115 (fallout from https://github.com/rust-lang/rust/pull/62550). r? @petrochenkov
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 7fda9158b4b..7096d6799e2 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -143,6 +143,7 @@ macro_rules! maybe_whole_expr { $p.token.span, ExprKind::Block(block, None), ThinVec::new() )); } + // N.B: `NtIdent(ident)` is normalized to `Ident` in `fn bump`. _ => {}, }; } @@ -2756,12 +2757,7 @@ impl<'a> Parser<'a> { // can't continue an expression after an ident token::Ident(name, is_raw) => token::ident_can_begin_expr(name, t.span, is_raw), token::Literal(..) | token::Pound => true, - token::Interpolated(ref nt) => match **nt { - token::NtIdent(..) | token::NtExpr(..) | - token::NtBlock(..) | token::NtPath(..) => true, - _ => false, - }, - _ => false + _ => t.is_whole_expr(), }; let cannot_continue_expr = self.look_ahead(1, token_cannot_continue_expr); if cannot_continue_expr { @@ -3728,6 +3724,7 @@ impl<'a> Parser<'a> { self.token.is_path_start() // e.g. `MY_CONST`; || self.token == token::Dot // e.g. `.5` for recovery; || self.token.can_begin_literal_or_bool() // e.g. `42`. + || self.token.is_whole_expr() } // Helper function to decide whether to parse as ident binding |
