diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2025-04-29 12:05:38 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2025-04-30 07:12:09 +1000 |
| commit | 880e6f716d741b4ef827d48e66c45c7887f82aa2 (patch) | |
| tree | e77b0985e121c4727d7d31f03c9323462332c3a3 /compiler/rustc_parse/src/parser | |
| parent | 298c56f4ba604d3c7025a44fe7bfe1134d6b56d6 (diff) | |
| download | rust-880e6f716d741b4ef827d48e66c45c7887f82aa2.tar.gz rust-880e6f716d741b4ef827d48e66c45c7887f82aa2.zip | |
Use `ThinVec` to shrink `LazyAttrTokenStreamInner`.
Diffstat (limited to 'compiler/rustc_parse/src/parser')
| -rw-r--r-- | compiler/rustc_parse/src/parser/attr_wrapper.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/rustc_parse/src/parser/attr_wrapper.rs b/compiler/rustc_parse/src/parser/attr_wrapper.rs index 835226a64af..44fdf146f9c 100644 --- a/compiler/rustc_parse/src/parser/attr_wrapper.rs +++ b/compiler/rustc_parse/src/parser/attr_wrapper.rs @@ -10,6 +10,7 @@ use rustc_data_structures::fx::FxHashSet; use rustc_errors::PResult; use rustc_session::parse::ParseSess; use rustc_span::{DUMMY_SP, sym}; +use thin_vec::ThinVec; use super::{Capturing, ForceCollect, Parser, Trailing}; @@ -294,10 +295,10 @@ impl<'a> Parser<'a> { // This is hot enough for `deep-vector` that checking the conditions for an empty iterator // is measurably faster than actually executing the iterator. - let node_replacements: Box<[_]> = if parser_replacements_start == parser_replacements_end + let node_replacements = if parser_replacements_start == parser_replacements_end && inner_attr_parser_replacements.is_empty() { - Box::new([]) + ThinVec::new() } else { // Grab any replace ranges that occur *inside* the current AST node. Convert them // from `ParserRange` form to `NodeRange` form. We will perform the actual |
