Skip to content

Commit a894138

Browse files
committed
reorganize library/std/src/sync/mod.rs file
Moves things around to make a bit more sense (plus prepare moving `once` out of `poison`. Signed-off-by: Connor Tsui <[email protected]>
1 parent d2f9574 commit a894138

File tree

1 file changed

+29
-27
lines changed

1 file changed

+29
-27
lines changed

library/std/src/sync/mod.rs

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,20 @@ pub use alloc_crate::sync::UniqueArc;
181181
#[stable(feature = "rust1", since = "1.0.0")]
182182
pub use alloc_crate::sync::{Arc, Weak};
183183

184-
// FIXME(sync_nonpoison,sync_poison_mod): remove all `#[doc(inline)]` once the modules are stabilized.
184+
#[unstable(feature = "mpmc_channel", issue = "126840")]
185+
pub mod mpmc;
186+
pub mod mpsc;
187+
188+
// TODO: Make this `self::once::ONCE_INIT`.
189+
#[stable(feature = "rust1", since = "1.0.0")]
190+
#[doc(inline)]
191+
#[expect(deprecated)]
192+
pub use self::poison::ONCE_INIT;
193+
194+
mod barrier;
195+
mod lazy_lock;
196+
mod once_lock;
197+
mod reentrant_lock;
185198

186199
// These exist only in one flavor: no poisoning.
187200
#[stable(feature = "rust1", since = "1.0.0")]
@@ -193,49 +206,38 @@ pub use self::once_lock::OnceLock;
193206
#[unstable(feature = "reentrant_lock", issue = "121440")]
194207
pub use self::reentrant_lock::{ReentrantLock, ReentrantLockGuard};
195208

196-
// These make sense and exist only with poisoning.
209+
// Note: in the future we will change the default version in `std::sync` to the non-poisoning
210+
// version over an edition.
211+
// See https://github.com/rust-lang/rust/issues/134645#issuecomment-3324577500 for more details.
212+
213+
#[unstable(feature = "sync_nonpoison", issue = "134645")]
214+
pub mod nonpoison;
215+
#[unstable(feature = "sync_poison_mod", issue = "134646")]
216+
pub mod poison;
217+
218+
// FIXME(sync_poison_mod): remove all `#[doc(inline)]` once the modules are stabilized.
219+
220+
// These exist only with poisoning.
197221
#[stable(feature = "rust1", since = "1.0.0")]
198222
#[doc(inline)]
199223
pub use self::poison::{LockResult, PoisonError};
200224

201-
// These (should) exist in both flavors: with and without poisoning.
202-
// FIXME(sync_nonpoison): implement nonpoison versions:
203-
// * Mutex (nonpoison_mutex)
204-
// * Condvar (nonpoison_condvar)
205-
// * Once (nonpoison_once)
206-
// * RwLock (nonpoison_rwlock)
225+
// These exist in both flavors: with and without poisoning.
207226
// The historical default is the version with poisoning.
208227
#[stable(feature = "rust1", since = "1.0.0")]
209228
#[doc(inline)]
210229
pub use self::poison::{
211230
TryLockError, TryLockResult,
212-
Condvar,
213231
Mutex, MutexGuard,
214232
RwLock, RwLockReadGuard, RwLockWriteGuard,
233+
Condvar,
215234
Once, OnceState,
216235
};
217-
#[stable(feature = "rust1", since = "1.0.0")]
218-
#[doc(inline)]
219-
#[expect(deprecated)]
220-
pub use self::poison::ONCE_INIT;
236+
221237
#[unstable(feature = "mapped_lock_guards", issue = "117108")]
222238
#[doc(inline)]
223239
pub use self::poison::{MappedMutexGuard, MappedRwLockReadGuard, MappedRwLockWriteGuard};
224240

225-
#[unstable(feature = "mpmc_channel", issue = "126840")]
226-
pub mod mpmc;
227-
pub mod mpsc;
228-
229-
#[unstable(feature = "sync_nonpoison", issue = "134645")]
230-
pub mod nonpoison;
231-
#[unstable(feature = "sync_poison_mod", issue = "134646")]
232-
pub mod poison;
233-
234-
mod barrier;
235-
mod lazy_lock;
236-
mod once_lock;
237-
mod reentrant_lock;
238-
239241
/// A type indicating whether a timed wait on a condition variable returned
240242
/// due to a time out or not.
241243
///

0 commit comments

Comments
 (0)