thread_local: refine LazyKeyInner::take safety doc

Co-authored-by: joboet <jonasboettiger@icloud.com>
This commit is contained in:
Jubilee 2024-04-26 18:28:46 -07:00 committed by GitHub
parent 43f21a6871
commit c63b0ceb94
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -94,7 +94,7 @@ pub unsafe fn initialize<F: FnOnce() -> T>(&self, init: F) -> &'static T {
/// Watch out: unsynchronized internal mutability! /// Watch out: unsynchronized internal mutability!
/// ///
/// # Safety /// # Safety
/// Unsound if called while any `&'static T` is active. /// Causes UB if any reference to the value is used after this.
#[allow(unused)] #[allow(unused)]
pub(crate) unsafe fn take(&self) -> Option<T> { pub(crate) unsafe fn take(&self) -> Option<T> {
let mutable: *mut _ = UnsafeCell::get(&self.inner); let mutable: *mut _ = UnsafeCell::get(&self.inner);