about summary refs log tree commit diff
path: root/compiler/rustc_session/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-09-10 11:07:51 +0000
committerbors <bors@rust-lang.org>2023-09-10 11:07:51 +0000
commit6645a93cef04c23d210b534d0f338e468e1e9bd6 (patch)
treedefae1c0ed7ceb38428ccfdc740a6a1aac1e1643 /compiler/rustc_session/src
parent01ce2d0ea18bb48d4eb03d7b4b13ed7fd394b1e5 (diff)
parent1d8fdc03323959b69365123036637c056182b861 (diff)
downloadrust-6645a93cef04c23d210b534d0f338e468e1e9bd6.tar.gz
rust-6645a93cef04c23d210b534d0f338e468e1e9bd6.zip
Auto merge of #115711 - Zoxc:freeze-cstore, r=oli-obk
Use `FreezeLock` for `CStore`

This uses `FreezeLock` to protect the `CStore`. `FreezeReadGuard` and `FreezeWriteGuard` are changed to support a `map` operation.

r? `@oli-obk`
Diffstat (limited to 'compiler/rustc_session/src')
-rw-r--r--compiler/rustc_session/src/cstore.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_session/src/cstore.rs b/compiler/rustc_session/src/cstore.rs
index 90f57be9324..d816842b02b 100644
--- a/compiler/rustc_session/src/cstore.rs
+++ b/compiler/rustc_session/src/cstore.rs
@@ -7,7 +7,7 @@ use crate::utils::NativeLibKind;
 use crate::Session;
 use rustc_ast as ast;
 use rustc_data_structures::owned_slice::OwnedSlice;
-use rustc_data_structures::sync::{self, AppendOnlyIndexVec, FreezeLock, RwLock};
+use rustc_data_structures::sync::{self, AppendOnlyIndexVec, FreezeLock};
 use rustc_hir::def_id::{CrateNum, DefId, LocalDefId, StableCrateId, LOCAL_CRATE};
 use rustc_hir::definitions::{DefKey, DefPath, DefPathHash, Definitions};
 use rustc_span::hygiene::{ExpnHash, ExpnId};
@@ -258,7 +258,7 @@ pub trait CrateStore: std::fmt::Debug {
 pub type CrateStoreDyn = dyn CrateStore + sync::DynSync + sync::DynSend;
 
 pub struct Untracked {
-    pub cstore: RwLock<Box<CrateStoreDyn>>,
+    pub cstore: FreezeLock<Box<CrateStoreDyn>>,
     /// Reference span for definitions.
     pub source_span: AppendOnlyIndexVec<LocalDefId, Span>,
     pub definitions: FreezeLock<Definitions>,