diff options
| author | Jubilee Young <workingjubilee@gmail.com> | 2024-09-17 09:31:57 -0700 |
|---|---|---|
| committer | Jubilee Young <workingjubilee@gmail.com> | 2024-09-18 11:39:21 -0700 |
| commit | d9cdb71497fbfcf36f6debd3fcf559c0fe3cf9ec (patch) | |
| tree | 06148c0e4cc30c7a674963d9e1b934bdfcf31254 /library/std/src/sync | |
| parent | d0a2ca4867c15659e28ab9c3930b5df4e60afcb0 (diff) | |
| download | rust-d9cdb71497fbfcf36f6debd3fcf559c0fe3cf9ec.tar.gz rust-d9cdb71497fbfcf36f6debd3fcf559c0fe3cf9ec.zip | |
library: Destabilize Lazy{Cell,Lock}::{force,deref}_mut
Diffstat (limited to 'library/std/src/sync')
| -rw-r--r-- | library/std/src/sync/lazy_lock.rs | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/library/std/src/sync/lazy_lock.rs b/library/std/src/sync/lazy_lock.rs index afdfec43afd..f6b6887cdbb 100644 --- a/library/std/src/sync/lazy_lock.rs +++ b/library/std/src/sync/lazy_lock.rs @@ -1,7 +1,7 @@ use super::once::ExclusiveState; use crate::cell::UnsafeCell; use crate::mem::ManuallyDrop; -use crate::ops::{Deref, DerefMut}; +use crate::ops::Deref; use crate::panic::{RefUnwindSafe, UnwindSafe}; use crate::sync::Once; use crate::{fmt, ptr}; @@ -137,11 +137,10 @@ impl<T, F: FnOnce() -> T> LazyLock<T, F> { /// Forces the evaluation of this lazy value and returns a mutable reference to /// the result. /// - /// This is equivalent to the `DerefMut` impl, but is explicit. - /// /// # Examples /// /// ``` + /// #![feature(lazy_get)] /// use std::sync::LazyLock; /// /// let mut lazy = LazyLock::new(|| 92); @@ -150,11 +149,9 @@ impl<T, F: FnOnce() -> T> LazyLock<T, F> { /// assert_eq!(*p, 92); /// *p = 44; /// assert_eq!(*lazy, 44); - /// *lazy = 55; // Using `DerefMut` - /// assert_eq!(*lazy, 55); /// ``` #[inline] - #[stable(feature = "lazy_deref_mut", since = "CURRENT_RUSTC_VERSION")] + #[unstable(feature = "lazy_get", issue = "129333")] pub fn force_mut(this: &mut LazyLock<T, F>) -> &mut T { #[cold] /// # Safety @@ -317,14 +314,6 @@ impl<T, F: FnOnce() -> T> Deref for LazyLock<T, F> { } } -#[stable(feature = "lazy_deref_mut", since = "CURRENT_RUSTC_VERSION")] -impl<T, F: FnOnce() -> T> DerefMut for LazyLock<T, F> { - #[inline] - fn deref_mut(&mut self) -> &mut T { - LazyLock::force_mut(self) - } -} - #[stable(feature = "lazy_cell", since = "1.80.0")] impl<T: Default> Default for LazyLock<T> { /// Creates a new lazy value using `Default` as the initializing function. |
