Skip to content

Commit 139e946

Browse files
committed
Optimize visible_parent_map to use LRC to prevent unnecessary cloning
1 parent 8ad3c1d commit 139e946

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ pub fn provide(providers: &mut Providers) {
360360
visible_parent_map.entry(child).or_insert(parent);
361361
}
362362

363-
visible_parent_map
363+
Lrc::new(visible_parent_map)
364364
},
365365

366366
dependency_formats: |tcx, ()| Lrc::new(crate::dependency_format::calculate(tcx)),

compiler/rustc_middle/src/query/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1552,7 +1552,7 @@ rustc_queries! {
15521552
desc { "calculating the missing lang items in a crate" }
15531553
separate_provide_extern
15541554
}
1555-
query visible_parent_map(_: ()) -> DefIdMap<DefId> {
1555+
query visible_parent_map(_: ()) -> Lrc<DefIdMap<DefId>> {
15561556
storage(ArenaCacheSelector<'tcx>)
15571557
desc { "calculating the visible parent map" }
15581558
}

0 commit comments

Comments
 (0)