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

@@ -54,7 +54,7 @@ impl<'a> Parser<'a> {
stmt.visit_attrs(|stmt_attrs| {
attrs.prepend_to_nt_inner(stmt_attrs);
});
return Ok(Some(stmt));
return Ok(Some(stmt.into_inner()));
}
Ok(Some(if self.token.is_keyword(kw::Let) {
@@ -535,7 +535,7 @@ impl<'a> Parser<'a> {
recover: AttemptLocalParseRecovery,
) -> PResult<'a, Option<Stmt>> {
// Skip looking for a trailing semicolon when we have an interpolated statement.
maybe_whole!(self, NtStmt, |x| Some(x));
maybe_whole!(self, NtStmt, |x| Some(x.into_inner()));
let Some(mut stmt) = self.parse_stmt_without_recovery(true, ForceCollect::No)? else {
return Ok(None);