about summary refs log tree commit diff
path: root/compiler/rustc_data_structures/src/sync.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-09-02 03:06:11 +0000
committerbors <bors@rust-lang.org>2023-09-02 03:06:11 +0000
commit9dc11a13fa848c1b09b7248c540528190dcb79c5 (patch)
treee98a3b294cebc0ae4d88cb08bb035bb8e7303af7 /compiler/rustc_data_structures/src/sync.rs
parentf9ba43ce147707fb90d038983789d8e57451eb6d (diff)
parent90f5f94699c431d0def5776388ff42da908e54f8 (diff)
downloadrust-9dc11a13fa848c1b09b7248c540528190dcb79c5.tar.gz
rust-9dc11a13fa848c1b09b7248c540528190dcb79c5.zip
Auto merge of #115422 - Zoxc:cache-once-lock, r=cjgillot
Use `OnceLock` for `SingleCache`

This uses `OnceLock` for `SingleCache` instead of `Lock<Option<T>>` so lookups are lock-free.

r? `@cjgillot`
Diffstat (limited to 'compiler/rustc_data_structures/src/sync.rs')
-rw-r--r--compiler/rustc_data_structures/src/sync.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_data_structures/src/sync.rs b/compiler/rustc_data_structures/src/sync.rs
index 2ec509b9118..e82b0f6d496 100644
--- a/compiler/rustc_data_structures/src/sync.rs
+++ b/compiler/rustc_data_structures/src/sync.rs
@@ -273,7 +273,7 @@ cfg_if! {
         pub use std::cell::RefMut as MappedWriteGuard;
         pub use std::cell::RefMut as MappedLockGuard;
 
-        pub use std::cell::OnceCell;
+        pub use std::cell::OnceCell as OnceLock;
 
         use std::cell::RefCell as InnerRwLock;
 
@@ -327,7 +327,7 @@ cfg_if! {
 
         pub use parking_lot::MappedMutexGuard as MappedLockGuard;
 
-        pub use std::sync::OnceLock as OnceCell;
+        pub use std::sync::OnceLock;
 
         pub use std::sync::atomic::{AtomicBool, AtomicUsize, AtomicU32, AtomicU64};