1
Fork 0

Remove NtItem and NtStmt.

This involves replacing `nt_pretty_printing_compatibility_hack` with
`stream_pretty_printing_compatibility_hack`.

The handling of statements in `transcribe` is slightly different to
other nonterminal kinds, due to the lack of `from_ast` implementation
for empty statements.

Notable test changes:
- `tests/ui/proc-macro/expand-to-derive.rs`: the diff looks large but
  the only difference is the insertion of a single invisible-delimited
  group around a metavar.
This commit is contained in:
Nicholas Nethercote 2024-04-18 14:53:52 +10:00
parent 98a48781fe
commit 141719f68a
18 changed files with 198 additions and 145 deletions

View file

@ -1076,10 +1076,12 @@ impl<'a> Parser<'a> {
let initial_semicolon = self.token.span;
while self.eat(exp!(Semi)) {
let _ = self.parse_stmt_without_recovery(false, ForceCollect::No).unwrap_or_else(|e| {
e.cancel();
None
});
let _ = self
.parse_stmt_without_recovery(false, ForceCollect::No, false)
.unwrap_or_else(|e| {
e.cancel();
None
});
}
expect_err
@ -1746,6 +1748,8 @@ pub enum ParseNtResult {
Tt(TokenTree),
Ident(Ident, IdentIsRaw),
Lifetime(Ident, IdentIsRaw),
Item(P<ast::Item>),
Stmt(P<ast::Stmt>),
Pat(P<ast::Pat>, NtPatKind),
Ty(P<ast::Ty>),
Meta(P<ast::AttrItem>),