Shrink Nonterminal.

By heap allocating the argument within `NtPath`, `NtVis`, and `NtStmt`.
This slightly reduces cumulative and peak allocation amounts, most
notably on `deep-vector`.
This commit is contained in:
Nicholas Nethercote 2022-04-06 12:08:39 +10:00
parent c2afaba465
commit d9592c2d9f
10 changed files with 18 additions and 16 deletions

View file

@ -118,7 +118,7 @@ impl Annotatable {
Annotatable::ForeignItem(item) => {
token::NtItem(P(item.and_then(ast::ForeignItem::into_item)))
}
Annotatable::Stmt(stmt) => token::NtStmt(stmt.into_inner()),
Annotatable::Stmt(stmt) => token::NtStmt(stmt),
Annotatable::Expr(expr) => token::NtExpr(expr),
Annotatable::Arm(..)
| Annotatable::ExprField(..)

View file

@ -90,7 +90,7 @@ impl MultiItemModifier for ProcMacroDerive {
// A proc macro can't observe the fact that we're passing
// them an `NtStmt` - it can only see the underlying tokens
// of the wrapped item
token::NtStmt(stmt.into_inner())
token::NtStmt(stmt)
}
_ => unreachable!(),
};