Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions library/std/src/sync/once_lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,6 @@ impl<T> OnceLock<T> {
///
/// Waiting for a computation on another thread to finish:
/// ```rust
/// #![feature(once_wait)]
///
/// use std::thread;
/// use std::sync::OnceLock;
///
Expand All @@ -189,7 +187,7 @@ impl<T> OnceLock<T> {
/// })
/// ```
#[inline]
#[unstable(feature = "once_wait", issue = "127527")]
#[stable(feature = "once_wait", since = "CURRENT_RUSTC_VERSION")]
pub fn wait(&self) -> &T {
self.once.wait_force();

Expand Down
6 changes: 2 additions & 4 deletions library/std/src/sync/poison/once.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,6 @@ impl Once {
/// # Example
///
/// ```rust
/// #![feature(once_wait)]
///
/// use std::sync::Once;
/// use std::thread;
///
Expand All @@ -289,7 +287,7 @@ impl Once {
/// If this [`Once`] has been poisoned because an initialization closure has
/// panicked, this method will also panic. Use [`wait_force`](Self::wait_force)
/// if this behavior is not desired.
#[unstable(feature = "once_wait", issue = "127527")]
#[stable(feature = "once_wait", since = "CURRENT_RUSTC_VERSION")]
pub fn wait(&self) {
if !self.inner.is_completed() {
self.inner.wait(false);
Expand All @@ -298,7 +296,7 @@ impl Once {

/// Blocks the current thread until initialization has completed, ignoring
/// poisoning.
#[unstable(feature = "once_wait", issue = "127527")]
#[stable(feature = "once_wait", since = "CURRENT_RUSTC_VERSION")]
pub fn wait_force(&self) {
if !self.inner.is_completed() {
self.inner.wait(true);
Expand Down
Loading