diff options
| author | bors <bors@rust-lang.org> | 2025-04-14 03:56:55 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-04-14 03:56:55 +0000 |
| commit | f836ae4e663b6e8938096b8559e094d18361be55 (patch) | |
| tree | 210d28f13b7c2f09b8cc78ef0c4c146c0cc28322 /compiler/rustc_parse/src/parser/stmt.rs | |
| parent | 15f58c46da79399961a09db0c650a2f90f442e6b (diff) | |
| parent | 1830245a224c523f86ad3c62be76be3f336a9fb0 (diff) | |
| download | rust-f836ae4e663b6e8938096b8559e094d18361be55.tar.gz rust-f836ae4e663b6e8938096b8559e094d18361be55.zip | |
Auto merge of #124141 - nnethercote:rm-Nonterminal-and-TokenKind-Interpolated, r=petrochenkov
Remove `Nonterminal` and `TokenKind::Interpolated` A third attempt at this; the first attempt was #96724 and the second was #114647. r? `@ghost`
Diffstat (limited to 'compiler/rustc_parse/src/parser/stmt.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/stmt.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/compiler/rustc_parse/src/parser/stmt.rs b/compiler/rustc_parse/src/parser/stmt.rs index e00fd40ecee..a50a9e224cf 100644 --- a/compiler/rustc_parse/src/parser/stmt.rs +++ b/compiler/rustc_parse/src/parser/stmt.rs @@ -23,8 +23,8 @@ use super::{ AttrWrapper, BlockMode, FnParseMode, ForceCollect, Parser, Restrictions, SemiColonMode, Trailing, UsePreAttrPos, }; -use crate::errors::MalformedLoopLabel; -use crate::{errors, exp, maybe_whole}; +use crate::errors::{self, MalformedLoopLabel}; +use crate::exp; impl<'a> Parser<'a> { /// Parses a statement. This stops just before trailing semicolons on everything but items. @@ -696,9 +696,11 @@ impl<'a> Parser<'a> { blk_mode: BlockCheckMode, loop_header: Option<Span>, ) -> PResult<'a, (AttrVec, P<Block>)> { - maybe_whole!(self, NtBlock, |block| (AttrVec::new(), block)); + if let Some(block) = self.eat_metavar_seq(MetaVarKind::Block, |this| this.parse_block()) { + return Ok((AttrVec::new(), block)); + } - let maybe_ident = self.prev_token.clone(); + let maybe_ident = self.prev_token; self.maybe_recover_unexpected_block_label(loop_header); if !self.eat(exp!(OpenBrace)) { return self.error_block_no_opening_brace(); @@ -911,7 +913,7 @@ impl<'a> Parser<'a> { { if self.token == token::Colon && self.look_ahead(1, |token| { - token.is_whole_block() + token.is_metavar_block() || matches!( token.kind, token::Ident( |
