Skip to content

Commit 1cec923

Browse files
committed
rustc_metadata: Freeze cstore after the full crate list is queried
1 parent 71927ad commit 1cec923

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

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

+3
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,9 @@ pub(in crate::rmeta) fn provide(providers: &mut Providers) {
490490
.alloc_slice(&CStore::from_tcx(tcx).crate_dependencies_in_postorder(LOCAL_CRATE))
491491
},
492492
crates: |tcx, ()| {
493+
// The list of loaded crates is now frozen in query cache,
494+
// so make sure cstore is not mutably accessed from here on.
495+
tcx.untracked().cstore.leak();
493496
tcx.arena.alloc_from_iter(CStore::from_tcx(tcx).iter_crate_data().map(|(cnum, _)| cnum))
494497
},
495498
..*providers

0 commit comments

Comments
 (0)