Skip to content

Commit 3a9c521

Browse files
committed
move once module out of poison
Since `Once` will not have a non-poisoning variant, we remove it from the `poison` module. Signed-off-by: Connor Tsui <[email protected]>
1 parent 7b61403 commit 3a9c521

File tree

7 files changed

+10
-13
lines changed

7 files changed

+10
-13
lines changed

library/std/src/sync/lazy_lock.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use super::poison::once::OnceExclusiveState;
1+
use super::once::OnceExclusiveState;
22
use crate::cell::UnsafeCell;
33
use crate::mem::ManuallyDrop;
44
use crate::ops::{Deref, DerefMut};

library/std/src/sync/mod.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,15 @@ pub use alloc_crate::sync::{Arc, Weak};
185185
pub mod mpmc;
186186
pub mod mpsc;
187187

188-
// TODO: Make this `self::once::ONCE_INIT`.
188+
pub(crate) mod once; // `pub(crate)` for the `sys::sync::once` implementations and `LazyLock`.
189+
190+
#[stable(feature = "rust1", since = "1.0.0")]
191+
pub use self::once::{Once, OnceState};
192+
189193
#[stable(feature = "rust1", since = "1.0.0")]
190194
#[doc(inline)]
191195
#[expect(deprecated)]
192-
pub use self::poison::ONCE_INIT;
196+
pub use self::once::ONCE_INIT;
193197

194198
mod barrier;
195199
mod lazy_lock;
@@ -231,7 +235,6 @@ pub use self::poison::{
231235
Mutex, MutexGuard,
232236
RwLock, RwLockReadGuard, RwLockWriteGuard,
233237
Condvar,
234-
Once, OnceState,
235238
};
236239

237240
#[unstable(feature = "mapped_lock_guards", issue = "117108")]
File renamed without changes.

library/std/src/sync/poison.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,6 @@ pub use self::condvar::Condvar;
6666
pub use self::mutex::MappedMutexGuard;
6767
#[stable(feature = "rust1", since = "1.0.0")]
6868
pub use self::mutex::{Mutex, MutexGuard};
69-
#[stable(feature = "rust1", since = "1.0.0")]
70-
#[expect(deprecated)]
71-
pub use self::once::ONCE_INIT;
72-
#[stable(feature = "rust1", since = "1.0.0")]
73-
pub use self::once::{Once, OnceState};
7469
#[unstable(feature = "mapped_lock_guards", issue = "117108")]
7570
pub use self::rwlock::{MappedRwLockReadGuard, MappedRwLockWriteGuard};
7671
#[stable(feature = "rust1", since = "1.0.0")]
@@ -85,7 +80,6 @@ use crate::thread;
8580
mod condvar;
8681
#[stable(feature = "rust1", since = "1.0.0")]
8782
mod mutex;
88-
pub(crate) mod once;
8983
mod rwlock;
9084

9185
pub(crate) struct Flag {

library/std/src/sys/sync/once/futex.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::cell::Cell;
22
use crate::sync as public;
33
use crate::sync::atomic::Ordering::{Acquire, Relaxed, Release};
4-
use crate::sync::poison::once::OnceExclusiveState;
4+
use crate::sync::once::OnceExclusiveState;
55
use crate::sys::futex::{Futex, Primitive, futex_wait, futex_wake_all};
66

77
// On some platforms, the OS is very nice and handles the waiter queue for us.

library/std/src/sys/sync/once/no_threads.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::cell::Cell;
22
use crate::sync as public;
3-
use crate::sync::poison::once::OnceExclusiveState;
3+
use crate::sync::once::OnceExclusiveState;
44

55
pub struct Once {
66
state: Cell<State>,

library/std/src/sys/sync/once/queue.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
use crate::cell::Cell;
5959
use crate::sync::atomic::Ordering::{AcqRel, Acquire, Release};
6060
use crate::sync::atomic::{Atomic, AtomicBool, AtomicPtr};
61-
use crate::sync::poison::once::OnceExclusiveState;
61+
use crate::sync::once::OnceExclusiveState;
6262
use crate::thread::{self, Thread};
6363
use crate::{fmt, ptr, sync as public};
6464

0 commit comments

Comments
 (0)