We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e3d63d7 commit 5ed5bb8Copy full SHA for 5ed5bb8
library/std/src/sync/once_lock.rs
@@ -47,7 +47,6 @@ use crate::sync::Once;
47
/// You can use `OnceLock` to implement a type that requires "append-only" logic:
48
///
49
/// ```
50
-/// #![feature(once_cell_try_insert)]
51
/// use std::sync::{OnceLock, atomic::{AtomicU32, Ordering}};
52
/// use std::thread;
53
@@ -62,7 +61,7 @@ use crate::sync::Once;
62
61
/// fn push(&self, value: T) {
63
/// // FIXME: this impl is concise, but is also slow for long lists or many threads.
64
/// // as an exercise, consider how you might improve on it while preserving the behavior
65
-/// if let Err((_, value)) = self.data.try_insert(value) {
+/// if let Err(value) = self.data.set(value) {
66
/// let next = self.next.get_or_init(|| Box::new(OnceList::new()));
67
/// next.push(value)
68
/// };
0 commit comments