diff options
| author | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2023-09-02 01:28:04 +0200 |
|---|---|---|
| committer | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2023-09-02 08:14:06 +0200 |
| commit | a3ad045ea49b0613505e02bb0036575d1fc0c99f (patch) | |
| tree | 9bf3ec45f379760baa2dbeb6c51e6c71efb5226d /compiler/rustc_data_structures/src | |
| parent | 50f0d666d3308f0b0a45842cbe725fcb5b3c3861 (diff) | |
| download | rust-a3ad045ea49b0613505e02bb0036575d1fc0c99f.tar.gz rust-a3ad045ea49b0613505e02bb0036575d1fc0c99f.zip | |
Rename `Freeze` to `FreezeLock`
Diffstat (limited to 'compiler/rustc_data_structures/src')
| -rw-r--r-- | compiler/rustc_data_structures/src/sync.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_data_structures/src/sync/freeze.rs | 14 |
2 files changed, 8 insertions, 8 deletions
diff --git a/compiler/rustc_data_structures/src/sync.rs b/compiler/rustc_data_structures/src/sync.rs index a8f42e0ed0e..8eda9043e35 100644 --- a/compiler/rustc_data_structures/src/sync.rs +++ b/compiler/rustc_data_structures/src/sync.rs @@ -62,7 +62,7 @@ pub use vec::{AppendOnlyIndexVec, AppendOnlyVec}; mod vec; mod freeze; -pub use freeze::{Freeze, FreezeReadGuard, FreezeWriteGuard}; +pub use freeze::{FreezeLock, FreezeReadGuard, FreezeWriteGuard}; mod mode { use super::Ordering; diff --git a/compiler/rustc_data_structures/src/sync/freeze.rs b/compiler/rustc_data_structures/src/sync/freeze.rs index e9ad6ee8394..ea75dcc4151 100644 --- a/compiler/rustc_data_structures/src/sync/freeze.rs +++ b/compiler/rustc_data_structures/src/sync/freeze.rs @@ -12,7 +12,7 @@ use std::{ /// /// Unlike `RwLock`, it can be used to prevent mutation past a point. #[derive(Default)] -pub struct Freeze<T> { +pub struct FreezeLock<T> { data: UnsafeCell<T>, frozen: AtomicBool, @@ -21,9 +21,9 @@ pub struct Freeze<T> { } #[cfg(parallel_compiler)] -unsafe impl<T: DynSync + DynSend> DynSync for Freeze<T> {} +unsafe impl<T: DynSync + DynSend> DynSync for FreezeLock<T> {} -impl<T> Freeze<T> { +impl<T> FreezeLock<T> { #[inline] pub fn new(value: T) -> Self { Self { data: UnsafeCell::new(value), frozen: AtomicBool::new(false), lock: RwLock::new(()) } @@ -71,8 +71,8 @@ impl<T> Freeze<T> { } } -/// A guard holding shared access to a `Freeze` which is in a locked state or frozen. -#[must_use = "if unused the Freeze may immediately unlock"] +/// A guard holding shared access to a `FreezeLock` which is in a locked state or frozen. +#[must_use = "if unused the FreezeLock may immediately unlock"] pub struct FreezeReadGuard<'a, T> { _lock_guard: Option<ReadGuard<'a, ()>>, data: &'a T, @@ -86,8 +86,8 @@ impl<'a, T: 'a> Deref for FreezeReadGuard<'a, T> { } } -/// A guard holding mutable access to a `Freeze` which is in a locked state or frozen. -#[must_use = "if unused the Freeze may immediately unlock"] +/// A guard holding mutable access to a `FreezeLock` which is in a locked state or frozen. +#[must_use = "if unused the FreezeLock may immediately unlock"] pub struct FreezeWriteGuard<'a, T> { _lock_guard: WriteGuard<'a, ()>, data: &'a mut T, |
