1
Fork 0

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

@ -39,9 +39,7 @@ use rustc_data_structures::profiling::SelfProfilerRef;
use rustc_data_structures::sharded::{IntoPointer, ShardedHashMap};
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
use rustc_data_structures::steal::Steal;
use rustc_data_structures::sync::{
self, FreezeReadGuard, Lock, Lrc, MappedReadGuard, ReadGuard, WorkerLocal,
};
use rustc_data_structures::sync::{self, FreezeReadGuard, Lock, Lrc, WorkerLocal};
use rustc_data_structures::unord::UnordSet;
use rustc_errors::{
DecorateLint, DiagnosticBuilder, DiagnosticMessage, ErrorGuaranteed, MultiSpan,
@ -995,8 +993,8 @@ impl<'tcx> TyCtxt<'tcx> {
/// Note that this is *untracked* and should only be used within the query
/// system if the result is otherwise tracked through queries
#[inline]
pub fn cstore_untracked(self) -> MappedReadGuard<'tcx, CrateStoreDyn> {
ReadGuard::map(self.untracked.cstore.read(), |c| &**c)
pub fn cstore_untracked(self) -> FreezeReadGuard<'tcx, CrateStoreDyn> {
FreezeReadGuard::map(self.untracked.cstore.read(), |c| &**c)
}
/// Give out access to the untracked data without any sanity checks.