Skip to content

Commit

Permalink
Unrolled build for rust-lang#136360
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#136360 - slanterns:once_wait, r=tgross35

Stabilize `once_wait`

Closes: rust-lang#127527.

`@rustbot` label: +T-libs-api

r? libs-api
  • Loading branch information
rust-timer authored Feb 1, 2025
2 parents e08cd3c + 6fa6168 commit 9264389
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
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

0 comments on commit 9264389

Please sign in to comment.