library: Destabilize Lazy{Cell,Lock}::{force,deref}_mut · qinheping/verify-rust-std@51023b5 (original) (raw)
1
1
`use super:🔂: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,11 +137,10 @@ 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
```` /// ```
``
`143`
`+
/// #![feature(lazy_get)]
`
`145`
`144`
`/// use std::sync::LazyLock;
`
`146`
`145`
`///
`
`147`
`146`
`/// let mut lazy = LazyLock::new(|| 92);
`
`@@ -150,11 +149,9 @@ impl<T, F: FnOnce() -> T> LazyLock<T, F> {
`
`150`
`149`
`/// assert_eq!(*p, 92);
`
`151`
`150`
`/// *p = 44;
`
`152`
`151`
`/// assert_eq!(*lazy, 44);
`
`153`
``
`` -
/// *lazy = 55; // Using `DerefMut`
``
`154`
``
`-
/// assert_eq!(*lazy, 55);
`
`155`
`152`
```` /// ```
156
153
`#[inline]
`
157
``
`-
#[stable(feature = "lazy_deref_mut", since = "CURRENT_RUSTC_VERSION")]
`
``
154
`+
#[unstable(feature = "lazy_get", issue = "129333")]
`
158
155
`pub fn force_mut(this: &mut LazyLock<T, F>) -> &mut T {
`
159
156
`#[cold]
`
160
157
`/// # Safety
`
`@@ -317,14 +314,6 @@ impl<T, F: FnOnce() -> T> Deref for LazyLock<T, F> {
`
317
314
`}
`
318
315
`}
`
319
316
``
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
317
`#[stable(feature = "lazy_cell", since = "1.80.0")]
`
329
318
`impl<T: Default> Default for LazyLock {
`
330
319
`` /// Creates a new lazy value using Default
as the initializing function.
``