library: Call it really_init_mut to avoid name collisions · qinheping/verify-rust-std@262a08b (original) (raw)
2 files changed
lines changed
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -141,7 +141,7 @@ impl<T, F: FnOnce() -> T> LazyCell<T, F> { | ||
141 | 141 | #[cold] |
142 | 142 | /// # Safety |
143 | 143 | /// May only be called when the state is `Uninit`. |
144 | - unsafe fn really_init<T, F: FnOnce() -> T>(state: &mut State<T, F>) -> &mut T { | |
144 | + unsafe fn really_init_mut<T, F: FnOnce() -> T>(state: &mut State<T, F>) -> &mut T { | |
145 | 145 | // INVARIANT: Always valid, but the value may not be dropped. |
146 | 146 | struct PoisonOnPanic<T, F>(*mut State<T, F>); |
147 | 147 | impl<T, F> Drop for PoisonOnPanic<T, F> { |
@@ -179,7 +179,7 @@ impl<T, F: FnOnce() -> T> LazyCell<T, F> { | ||
179 | 179 | match state { |
180 | 180 | State::Init(data) => data, |
181 | 181 | // SAFETY: `state` is `Uninit`. |
182 | -State::Uninit(_) => unsafe { really_init(state) }, | |
182 | +State::Uninit(_) => unsafe { really_init_mut(state) }, | |
183 | 183 | State::Poisoned => panic_poisoned(), |
184 | 184 | } |
185 | 185 | } |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -156,7 +156,7 @@ impl<T, F: FnOnce() -> T> LazyLock<T, F> { | ||
156 | 156 | #[cold] |
157 | 157 | /// # Safety |
158 | 158 | /// May only be called when the state is `Incomplete`. |
159 | - unsafe fn really_init<T, F: FnOnce() -> T>(this: &mut LazyLock<T, F>) -> &mut T { | |
159 | + unsafe fn really_init_mut<T, F: FnOnce() -> T>(this: &mut LazyLock<T, F>) -> &mut T { | |
160 | 160 | struct PoisonOnPanic<'a, T, F>(&'a mut LazyLock<T, F>); |
161 | 161 | impl<T, F> Drop for PoisonOnPanic<'_, T, F> { |
162 | 162 | #[inline] |
@@ -184,7 +184,7 @@ impl<T, F: FnOnce() -> T> LazyLock<T, F> { | ||
184 | 184 | // SAFETY: The `Once` states we completed the initialization. |
185 | 185 | ExclusiveState::Complete => unsafe { &mut this.data.get_mut().value }, |
186 | 186 | // SAFETY: The state is `Incomplete`. |
187 | -ExclusiveState::Incomplete => unsafe { really_init(this) }, | |
187 | +ExclusiveState::Incomplete => unsafe { really_init_mut(this) }, | |
188 | 188 | } |
189 | 189 | } |
190 | 190 |