diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2022-04-06 12:08:39 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2022-04-07 12:51:50 +1000 |
| commit | d9592c2d9f0db851b090c10c0cc3560b87fc7789 (patch) | |
| tree | d2c6f22ebb2cc5e244b5c15609622c363146efdd /compiler/rustc_parse/src/parser/stmt.rs | |
| parent | c2afaba465e0bf44b9b37beba8d908b78dcdadc7 (diff) | |
| download | rust-d9592c2d9f0db851b090c10c0cc3560b87fc7789.tar.gz rust-d9592c2d9f0db851b090c10c0cc3560b87fc7789.zip | |
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`.
Diffstat (limited to 'compiler/rustc_parse/src/parser/stmt.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/stmt.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_parse/src/parser/stmt.rs b/compiler/rustc_parse/src/parser/stmt.rs index e3bcd945db7..5b7ae5f7a7b 100644 --- a/compiler/rustc_parse/src/parser/stmt.rs +++ b/compiler/rustc_parse/src/parser/stmt.rs @@ -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); |
