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

@ -1357,7 +1357,6 @@ impl<'a> Parser<'a> {
self.bump();
return Ok(self.mk_expr(self.prev_token.span, ExprKind::Block(block, None)));
}
_ => {}
};
} else if let Some(path) = self.eat_metavar_seq(MetaVarKind::Path, |this| {
this.collect_tokens_no_attrs(|this| this.parse_path(PathStyle::Type))
@ -3046,7 +3045,7 @@ impl<'a> Parser<'a> {
}
self.restore_snapshot(pre_pat_snapshot);
match self.parse_stmt_without_recovery(true, ForceCollect::No) {
match self.parse_stmt_without_recovery(true, ForceCollect::No, false) {
// Consume statements for as long as possible.
Ok(Some(stmt)) => {
stmts.push(stmt);