diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2021-05-06 16:21:40 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2021-06-06 14:21:12 +0300 |
| commit | cbdfa1edcaab0dc86b5f9696dea790403bcb0f19 (patch) | |
| tree | dadfd42b3cf5c90a9746367f32ce9fea64f942e8 /compiler/rustc_parse/src/parser/expr.rs | |
| parent | 9a576175cc9a0aecb85d0764a4f66ee29e26e155 (diff) | |
| download | rust-cbdfa1edcaab0dc86b5f9696dea790403bcb0f19.tar.gz rust-cbdfa1edcaab0dc86b5f9696dea790403bcb0f19.zip | |
parser: Ensure that all nonterminals have tokens after parsing
Diffstat (limited to 'compiler/rustc_parse/src/parser/expr.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/expr.rs | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index 56c97b59476..a764cf6bdb0 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -94,17 +94,7 @@ impl<'a> Parser<'a> { /// Parses an expression, forcing tokens to be collected pub fn parse_expr_force_collect(&mut self) -> PResult<'a, P<Expr>> { - // If we have outer attributes, then the call to `collect_tokens_trailing_token` - // will be made for us. - if matches!(self.token.kind, TokenKind::Pound | TokenKind::DocComment(..)) { - self.parse_expr() - } else { - // If we don't have outer attributes, then we need to ensure - // that collection happens by using `collect_tokens_no_attrs`. - // Expression don't support custom inner attributes, so `parse_expr` - // will never try to collect tokens if we don't have outer attributes. - self.collect_tokens_no_attrs(|this| this.parse_expr()) - } + self.collect_tokens_no_attrs(|this| this.parse_expr()) } pub fn parse_anon_const_expr(&mut self) -> PResult<'a, AnonConst> { |
