1
Fork 0

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`
This commit is contained in:
bors 2025-04-14 03:56:55 +00:00
commit f836ae4e66
61 changed files with 164 additions and 532 deletions

View file

@ -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(