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:
@@ -118,7 +118,7 @@ impl<'a> Parser<'a> {
|
||||
token::NtBlock(self.collect_tokens_no_attrs(|this| this.parse_block())?)
|
||||
}
|
||||
NonterminalKind::Stmt => match self.parse_stmt(ForceCollect::Yes)? {
|
||||
Some(s) => token::NtStmt(s),
|
||||
Some(s) => token::NtStmt(P(s)),
|
||||
None => {
|
||||
return Err(self.struct_span_err(self.token.span, "expected a statement"));
|
||||
}
|
||||
@@ -161,11 +161,11 @@ impl<'a> Parser<'a> {
|
||||
return Err(self.struct_span_err(self.token.span, msg));
|
||||
}
|
||||
NonterminalKind::Path => token::NtPath(
|
||||
self.collect_tokens_no_attrs(|this| this.parse_path(PathStyle::Type))?,
|
||||
P(self.collect_tokens_no_attrs(|this| this.parse_path(PathStyle::Type))?),
|
||||
),
|
||||
NonterminalKind::Meta => token::NtMeta(P(self.parse_attr_item(true)?)),
|
||||
NonterminalKind::Vis => token::NtVis(
|
||||
self.collect_tokens_no_attrs(|this| this.parse_visibility(FollowedByType::Yes))?,
|
||||
P(self.collect_tokens_no_attrs(|this| this.parse_visibility(FollowedByType::Yes))?),
|
||||
),
|
||||
NonterminalKind::Lifetime => {
|
||||
if self.check_lifetime() {
|
||||
|
||||
Reference in New Issue
Block a user