From f22797d3db7fac474662b2a6b3bf8c91679d8c33 Mon Sep 17 00:00:00 2001 From: Jubilee Young Date: Wed, 18 Sep 2024 11:30:34 -0700 Subject: [PATCH] library: Call it really_init_mut to avoid name collisions --- library/core/src/cell/lazy.rs | 4 ++-- 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 8c88f967aa23f..5bc13779af9f8 100644 --- a/library/core/src/cell/lazy.rs +++ b/library/core/src/cell/lazy.rs @@ -141,7 +141,7 @@ impl T> LazyCell { #[cold] /// # Safety /// May only be called when the state is `Uninit`. - unsafe fn really_init T>(state: &mut State) -> &mut T { + unsafe fn really_init_mut T>(state: &mut State) -> &mut T { // INVARIANT: Always valid, but the value may not be dropped. struct PoisonOnPanic(*mut State); impl Drop for PoisonOnPanic { @@ -179,7 +179,7 @@ impl T> LazyCell { 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 f6b6887cdbbd7..4b5ab810a8a96 100644 --- a/library/std/src/sync/lazy_lock.rs +++ b/library/std/src/sync/lazy_lock.rs @@ -156,7 +156,7 @@ impl T> LazyLock { #[cold] /// # Safety /// May only be called when the state is `Incomplete`. - unsafe fn really_init T>(this: &mut LazyLock) -> &mut T { + unsafe fn really_init_mut T>(this: &mut LazyLock) -> &mut T { struct PoisonOnPanic<'a, T, F>(&'a mut LazyLock); impl Drop for PoisonOnPanic<'_, T, F> { #[inline] @@ -184,7 +184,7 @@ impl T> LazyLock { // 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) }, } }