Skip to content

Commit 2287b60

Browse files
committed
remove FIXMEs in once_lock and lazy_lock
Both implementations require poisoning support. Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
1 parent 3a74360 commit 2287b60

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

library/std/src/sync/lazy_lock.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ union Data<T, F> {
7979
/// ```
8080
#[stable(feature = "lazy_cell", since = "1.80.0")]
8181
pub struct LazyLock<T, F = fn() -> T> {
82-
// FIXME(nonpoison_once): if possible, switch to nonpoison version once it is available
82+
/// We use `poison::Once` here to enable the `force_mut` method.
8383
once: Once,
8484
data: UnsafeCell<Data<T, F>>,
8585
}

library/std/src/sync/once_lock.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,10 @@ use crate::sync::Once;
106106
/// ```
107107
#[stable(feature = "once_cell", since = "1.70.0")]
108108
pub struct OnceLock<T> {
109-
// FIXME(nonpoison_once): switch to nonpoison version once it is available
109+
/// We use `poison::Once` here to allow us to pseudo-"poison" the `Once` whenever a
110+
/// `get_or_try_init` fails, which allows other calls to be run after a failure.
110111
once: Once,
111-
// Whether or not the value is initialized is tracked by `once.is_completed()`.
112+
/// Note that `once.is_completed()` tells us if the value is initialized or not.
112113
value: UnsafeCell<MaybeUninit<T>>,
113114
/// `PhantomData` to make sure dropck understands we're dropping T in our Drop impl.
114115
///

0 commit comments

Comments
 (0)