From 1defd3076473699332e1b4c424d35f0dfb28c63b Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Wed, 7 Jun 2023 09:24:51 +1000 Subject: [PATCH] Remove `PlacedRootMonoItems::roots`. It's no longer used. --- compiler/rustc_monomorphize/src/partitioning.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/compiler/rustc_monomorphize/src/partitioning.rs b/compiler/rustc_monomorphize/src/partitioning.rs index 737c0b035e7..e3a226fd427 100644 --- a/compiler/rustc_monomorphize/src/partitioning.rs +++ b/compiler/rustc_monomorphize/src/partitioning.rs @@ -129,7 +129,6 @@ struct PlacedRootMonoItems<'tcx> { /// The codegen units, sorted by name to make things deterministic. codegen_units: Vec>, - roots: FxHashSet>, internalization_candidates: FxHashSet>, } @@ -150,7 +149,7 @@ fn partition<'tcx, I>( // In the first step, we place all regular monomorphizations into their // respective 'home' codegen unit. Regular monomorphizations are all // functions and statics defined in the local crate. - let PlacedRootMonoItems { mut codegen_units, roots, internalization_candidates } = { + let PlacedRootMonoItems { mut codegen_units, internalization_candidates } = { let _prof_timer = tcx.prof.generic_activity("cgu_partitioning_place_roots"); place_root_mono_items(cx, mono_items) }; @@ -176,7 +175,7 @@ fn partition<'tcx, I>( // local functions the definition of which is marked with `#[inline]`. let mono_item_placements = { let _prof_timer = tcx.prof.generic_activity("cgu_partitioning_place_inline_items"); - place_inlined_mono_items(cx, &mut codegen_units, roots) + place_inlined_mono_items(cx, &mut codegen_units) }; for cgu in &mut codegen_units { @@ -244,7 +243,6 @@ fn place_root_mono_items<'tcx, I>( where I: Iterator>, { - let mut roots = FxHashSet::default(); let mut codegen_units = FxHashMap::default(); let is_incremental_build = cx.tcx.sess.opts.incremental.is_some(); let mut internalization_candidates = FxHashSet::default(); @@ -295,7 +293,6 @@ fn place_root_mono_items<'tcx, I>( } codegen_unit.items_mut().insert(mono_item, (linkage, visibility)); - roots.insert(mono_item); } // Always ensure we have at least one CGU; otherwise, if we have a @@ -308,7 +305,7 @@ fn place_root_mono_items<'tcx, I>( let mut codegen_units: Vec<_> = codegen_units.into_values().collect(); codegen_units.sort_by(|a, b| a.name().as_str().cmp(b.name().as_str())); - PlacedRootMonoItems { codegen_units, roots, internalization_candidates } + PlacedRootMonoItems { codegen_units, internalization_candidates } } // This function requires the CGUs to be sorted by name on input, and ensures @@ -416,7 +413,6 @@ enum MonoItemPlacement { fn place_inlined_mono_items<'tcx>( cx: &PartitioningCx<'_, 'tcx>, codegen_units: &mut [CodegenUnit<'tcx>], - _roots: FxHashSet>, ) -> FxHashMap, MonoItemPlacement> { for cgu in codegen_units.iter_mut() { // Collect all inlined items that need to be available in this codegen unit.