Use FreezeLock for CStore

This commit is contained in:
John Kåre Alsaker 2023-09-09 16:02:11 +02:00
parent 6cc1898f5f
commit 1d8fdc0332
8 changed files with 63 additions and 38 deletions

View file

@ -584,7 +584,7 @@ fn resolver_for_lowering<'tcx>(
let krate = configure_and_expand(krate, &pre_configured_attrs, &mut resolver);
// Make sure we don't mutate the cstore from here on.
tcx.untracked().cstore.leak();
tcx.untracked().cstore.freeze();
let ty::ResolverOutputs {
global_ctxt: untracked_resolutions,

View file

@ -7,9 +7,7 @@ use rustc_codegen_ssa::traits::CodegenBackend;
use rustc_codegen_ssa::CodegenResults;
use rustc_data_structures::steal::Steal;
use rustc_data_structures::svh::Svh;
use rustc_data_structures::sync::{
AppendOnlyIndexVec, FreezeLock, Lrc, OnceLock, RwLock, WorkerLocal,
};
use rustc_data_structures::sync::{AppendOnlyIndexVec, FreezeLock, Lrc, OnceLock, WorkerLocal};
use rustc_hir::def_id::{StableCrateId, CRATE_DEF_ID, LOCAL_CRATE};
use rustc_hir::definitions::Definitions;
use rustc_incremental::DepGraphFuture;
@ -195,7 +193,7 @@ impl<'tcx> Queries<'tcx> {
self.compiler.register_lints.as_deref(),
&pre_configured_attrs,
));
let cstore = RwLock::new(Box::new(CStore::new(
let cstore = FreezeLock::new(Box::new(CStore::new(
self.codegen_backend().metadata_loader(),
stable_crate_id,
)) as _);