Remove NtBlock, Nonterminal, and TokenKind::Interpolated.

`NtBlock` is the last remaining variant of `Nonterminal`, so once it is
gone then `Nonterminal` can be removed as well.
This commit is contained in:
Nicholas Nethercote 2024-04-18 20:18:13 +10:00
parent 70dab5a27c
commit bb495d6d3e
18 changed files with 108 additions and 388 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.
@ -681,7 +681,9 @@ 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();
self.maybe_recover_unexpected_block_label(loop_header);
@ -896,7 +898,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(