diff options
| -rw-r--r-- | library/core/src/cell/lazy.rs | 4 | ||||
| -rw-r--r-- | library/std/src/sync/lazy_lock.rs | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/library/core/src/cell/lazy.rs b/library/core/src/cell/lazy.rs index 8c88f967aa2..5bc13779af9 100644 --- a/library/core/src/cell/lazy.rs +++ b/library/core/src/cell/lazy.rs @@ -141,7 +141,7 @@ impl<T, F: FnOnce() -> T> LazyCell<T, F> { #[cold] /// # Safety /// May only be called when the state is `Uninit`. - unsafe fn really_init<T, F: FnOnce() -> T>(state: &mut State<T, F>) -> &mut T { + unsafe fn really_init_mut<T, F: FnOnce() -> T>(state: &mut State<T, F>) -> &mut T { // INVARIANT: Always valid, but the value may not be dropped. struct PoisonOnPanic<T, F>(*mut State<T, F>); impl<T, F> Drop for PoisonOnPanic<T, F> { @@ -179,7 +179,7 @@ impl<T, F: FnOnce() -> T> LazyCell<T, F> { match state { State::Init(data) => data, // SAFETY: `state` is `Uninit`. - State::Uninit(_) => unsafe { really_init(state) }, + State::Uninit(_) => unsafe { really_init_mut(state) }, State::Poisoned => panic_poisoned(), } } diff --git a/library/std/src/sync/lazy_lock.rs b/library/std/src/sync/lazy_lock.rs index f6b6887cdbb..4b5ab810a8a 100644 --- a/library/std/src/sync/lazy_lock.rs +++ b/library/std/src/sync/lazy_lock.rs @@ -156,7 +156,7 @@ impl<T, F: FnOnce() -> T> LazyLock<T, F> { #[cold] /// # Safety /// May only be called when the state is `Incomplete`. - unsafe fn really_init<T, F: FnOnce() -> T>(this: &mut LazyLock<T, F>) -> &mut T { + unsafe fn really_init_mut<T, F: FnOnce() -> T>(this: &mut LazyLock<T, F>) -> &mut T { struct PoisonOnPanic<'a, T, F>(&'a mut LazyLock<T, F>); impl<T, F> Drop for PoisonOnPanic<'_, T, F> { #[inline] @@ -184,7 +184,7 @@ impl<T, F: FnOnce() -> T> LazyLock<T, F> { // SAFETY: The `Once` states we completed the initialization. ExclusiveState::Complete => unsafe { &mut this.data.get_mut().value }, // SAFETY: The state is `Incomplete`. - ExclusiveState::Incomplete => unsafe { really_init(this) }, + ExclusiveState::Incomplete => unsafe { really_init_mut(this) }, } } |
