1
1
use super :: once:: ExclusiveState ;
2
2
use crate :: cell:: UnsafeCell ;
3
3
use crate :: mem:: ManuallyDrop ;
4
- use crate :: ops:: { Deref , DerefMut } ;
4
+ use crate :: ops:: Deref ;
5
5
use crate :: panic:: { RefUnwindSafe , UnwindSafe } ;
6
6
use crate :: sync:: Once ;
7
7
use crate :: { fmt, ptr} ;
@@ -137,8 +137,6 @@ impl<T, F: FnOnce() -> T> LazyLock<T, F> {
137
137
/// Forces the evaluation of this lazy value and returns a mutable reference to
138
138
/// the result.
139
139
///
140
- /// This is equivalent to the `DerefMut` impl, but is explicit.
141
- ///
142
140
/// # Examples
143
141
///
144
142
/// ```
@@ -150,11 +148,9 @@ impl<T, F: FnOnce() -> T> LazyLock<T, F> {
150
148
/// assert_eq!(*p, 92);
151
149
/// *p = 44;
152
150
/// assert_eq!(*lazy, 44);
153
- /// *lazy = 55; // Using `DerefMut`
154
- /// assert_eq!(*lazy, 55);
155
151
/// ```
156
152
#[ inline]
157
- #[ stable ( feature = "lazy_deref_mut " , since = "CURRENT_RUSTC_VERSION " ) ]
153
+ #[ unstable ( feature = "lazy_get " , issue = "129334 " ) ]
158
154
pub fn force_mut ( this : & mut LazyLock < T , F > ) -> & mut T {
159
155
#[ cold]
160
156
/// # Safety
@@ -317,14 +313,6 @@ impl<T, F: FnOnce() -> T> Deref for LazyLock<T, F> {
317
313
}
318
314
}
319
315
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
-
328
316
#[ stable( feature = "lazy_cell" , since = "1.80.0" ) ]
329
317
impl < T : Default > Default for LazyLock < T > {
330
318
/// Creates a new lazy value using `Default` as the initializing function.
0 commit comments