From 392045b7e70cc68290851451994d4ea135ec3f0a Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Mon, 5 Jun 2023 12:01:53 +1000 Subject: [PATCH] Make the two loops in `internalize_symbols` have the same form. Because the next commit will merge them. --- compiler/rustc_monomorphize/src/partitioning.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_monomorphize/src/partitioning.rs b/compiler/rustc_monomorphize/src/partitioning.rs index 2909042a931..fb8c21c59f2 100644 --- a/compiler/rustc_monomorphize/src/partitioning.rs +++ b/compiler/rustc_monomorphize/src/partitioning.rs @@ -491,11 +491,14 @@ fn internalize_symbols<'tcx>( // can internalize all candidates, since there is nowhere else they // could be used from. for cgu in codegen_units { - for candidate in &internalization_candidates { - cgu.items_mut().insert(*candidate, (Linkage::Internal, Visibility::Default)); + for (item, linkage_and_visibility) in cgu.items_mut() { + if !internalization_candidates.contains(item) { + // This item is no candidate for internalizing, so skip it. + continue; + } + *linkage_and_visibility = (Linkage::Internal, Visibility::Default); } } - return; }