11use super :: once:: ExclusiveState ;
22use crate :: cell:: UnsafeCell ;
33use crate :: mem:: ManuallyDrop ;
4- use crate :: ops:: { Deref , DerefMut } ;
4+ use crate :: ops:: Deref ;
55use crate :: panic:: { RefUnwindSafe , UnwindSafe } ;
66use crate :: sync:: Once ;
77use crate :: { fmt, ptr} ;
@@ -137,11 +137,10 @@ impl<T, F: FnOnce() -> T> LazyLock<T, F> {
137137 /// Forces the evaluation of this lazy value and returns a mutable reference to
138138 /// the result.
139139 ///
140- /// This is equivalent to the `DerefMut` impl, but is explicit.
141- ///
142140 /// # Examples
143141 ///
144142 /// ```
143+ /// #![feature(lazy_get)]
145144 /// use std::sync::LazyLock;
146145 ///
147146 /// let mut lazy = LazyLock::new(|| 92);
@@ -150,11 +149,9 @@ impl<T, F: FnOnce() -> T> LazyLock<T, F> {
150149 /// assert_eq!(*p, 92);
151150 /// *p = 44;
152151 /// assert_eq!(*lazy, 44);
153- /// *lazy = 55; // Using `DerefMut`
154- /// assert_eq!(*lazy, 55);
155152 /// ```
156153 #[ inline]
157- #[ stable ( feature = "lazy_deref_mut " , since = "CURRENT_RUSTC_VERSION " ) ]
154+ #[ unstable ( feature = "lazy_get " , issue = "129333 " ) ]
158155 pub fn force_mut ( this : & mut LazyLock < T , F > ) -> & mut T {
159156 #[ cold]
160157 /// # Safety
@@ -317,14 +314,6 @@ impl<T, F: FnOnce() -> T> Deref for LazyLock<T, F> {
317314 }
318315}
319316
320- #[ stable( feature = "lazy_deref_mut" , since = "CURRENT_RUSTC_VERSION" ) ]
321- impl < T , F : FnOnce ( ) -> T > DerefMut for LazyLock < T , F > {
322- #[ inline]
323- fn deref_mut ( & mut self ) -> & mut T {
324- LazyLock :: force_mut ( self )
325- }
326- }
327-
328317#[ stable( feature = "lazy_cell" , since = "1.80.0" ) ]
329318impl < T : Default > Default for LazyLock < T > {
330319 /// Creates a new lazy value using `Default` as the initializing function.
0 commit comments