Avoid cloning self.index in after_krate.
It can be very big. This reduces peak memory usage for some `--output-format=json` runs by up to 8%.
This commit is contained in:
parent
cc671754a3
commit
195c985398
1 changed files with 4 additions and 2 deletions
|
|
@ -294,11 +294,13 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> {
|
|||
unreachable!("RUN_ON_MODULE = false, should never call mod_item_in")
|
||||
}
|
||||
|
||||
fn after_krate(self) -> Result<(), Error> {
|
||||
fn after_krate(mut self) -> Result<(), Error> {
|
||||
debug!("Done with crate");
|
||||
|
||||
let e = ExternalCrate { crate_num: LOCAL_CRATE };
|
||||
let index = self.index.clone();
|
||||
|
||||
// We've finished using the index, and don't want to clone it, because it is big.
|
||||
let index = std::mem::take(&mut self.index);
|
||||
|
||||
// Note that tcx.rust_target_features is inappropriate here because rustdoc tries to run for
|
||||
// multiple targets: https://github.com/rust-lang/rust/pull/137632
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue