about summary refs log tree commit diff
path: root/src/libsyntax/parse/parser.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-08-01 14:43:00 +0000
committerbors <bors@rust-lang.org>2019-08-01 14:43:00 +0000
commit435236b8877cdb98c82eaebfb7887782277265c5 (patch)
tree5b8892a65e84fc77d3e28886dbf761de3d6f9335 /src/libsyntax/parse/parser.rs
parentf23a5f208de7fba983bfaaa8d60f1208d5780a98 (diff)
parentb1d5e52840f05e846a56023d2ec68bf700274552 (diff)
downloadrust-435236b8877cdb98c82eaebfb7887782277265c5.tar.gz
rust-435236b8877cdb98c82eaebfb7887782277265c5.zip
Auto merge of #63194 - pietroalbini:rollup-xgnvb1b, r=pietroalbini
Rollup of 8 pull requests

Successful merges:

 - #62644 (simplify std::io::Write::write rustdoc)
 - #62971 (Add keywords item into the sidebar)
 - #63122 (Account for `maybe_whole_expr` in range patterns)
 - #63158 (Add test for issue-58951)
 - #63170 (cleanup StringReader fields)
 - #63179 (update test cases for vxWorks)
 - #63188 (Fix typos in release notes.)
 - #63191 (ci: fix toolstate not pushing data for Linux)

Failed merges:

r? @ghost
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
-rw-r--r--src/libsyntax/parse/parser.rs9
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