-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move some things to std::sync::poison
and reexport them in std::sync
#134692
Open
GrigorenkoPV
wants to merge
1
commit into
rust-lang:master
Choose a base branch
from
GrigorenkoPV:sync_poision
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+141
−30
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -167,6 +167,11 @@ | |
|
||
#![stable(feature = "rust1", since = "1.0.0")] | ||
|
||
// No formatting: this file is just re-exports, and their order is worth preserving. | ||
#![cfg_attr(rustfmt, rustfmt::skip)] | ||
|
||
|
||
// These come from `core` & `alloc` and only in one flavor: no poisoning. | ||
#[unstable(feature = "exclusive_wrapper", issue = "98407")] | ||
pub use core::sync::Exclusive; | ||
#[stable(feature = "rust1", since = "1.0.0")] | ||
|
@@ -175,40 +180,60 @@ pub use core::sync::atomic; | |
#[stable(feature = "rust1", since = "1.0.0")] | ||
pub use alloc_crate::sync::{Arc, Weak}; | ||
|
||
// FIXME(sync_nonpoison,sync_poison_mod): remove all `#[doc(inline)]` once the modules are stabilized. | ||
|
||
// These exist only in one flavor: no poisoning. | ||
#[stable(feature = "rust1", since = "1.0.0")] | ||
pub use self::barrier::{Barrier, BarrierWaitResult}; | ||
#[stable(feature = "rust1", since = "1.0.0")] | ||
pub use self::condvar::{Condvar, WaitTimeoutResult}; | ||
#[stable(feature = "lazy_cell", since = "1.80.0")] | ||
pub use self::lazy_lock::LazyLock; | ||
#[unstable(feature = "mapped_lock_guards", issue = "117108")] | ||
pub use self::mutex::MappedMutexGuard; | ||
#[stable(feature = "rust1", since = "1.0.0")] | ||
pub use self::mutex::{Mutex, MutexGuard}; | ||
#[stable(feature = "rust1", since = "1.0.0")] | ||
#[allow(deprecated)] | ||
pub use self::once::{ONCE_INIT, Once, OnceState}; | ||
#[stable(feature = "once_cell", since = "1.70.0")] | ||
pub use self::once_lock::OnceLock; | ||
#[stable(feature = "rust1", since = "1.0.0")] | ||
pub use self::poison::{LockResult, PoisonError, TryLockError, TryLockResult}; | ||
#[unstable(feature = "reentrant_lock", issue = "121440")] | ||
pub use self::reentrant_lock::{ReentrantLock, ReentrantLockGuard}; | ||
#[unstable(feature = "mapped_lock_guards", issue = "117108")] | ||
pub use self::rwlock::{MappedRwLockReadGuard, MappedRwLockWriteGuard}; | ||
|
||
|
||
// These make sense and exist only with poisoning. | ||
#[stable(feature = "rust1", since = "1.0.0")] | ||
#[doc(inline)] | ||
pub use self::poison::{LockResult, PoisonError}; | ||
|
||
|
||
// These (should) exist in both flavors: with and without poisoning. | ||
// FIXME(sync_nonpoison): implement nonpoison versions: | ||
// * Mutex (nonpoison_mutex) | ||
// * Condvar (nonpoison_condvar) | ||
// * Once (nonpoison_once) | ||
// * RwLock (nonpoison_rwlock) | ||
|
||
// FIXME(sync_nonpoison): conditionally select the default flavor based on edition(?). | ||
use self::poison as default_poison_flavor; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We are at least two years off from an edition where we would change these defaults, so I don't think this needs to be addressed at this point. Just reexporting from |
||
|
||
#[stable(feature = "rust1", since = "1.0.0")] | ||
#[doc(inline)] | ||
pub use default_poison_flavor::{ | ||
Mutex, MutexGuard, TryLockError, TryLockResult, | ||
Condvar, WaitTimeoutResult, | ||
Once, OnceState, | ||
RwLock, RwLockReadGuard, RwLockWriteGuard, | ||
}; | ||
#[stable(feature = "rust1", since = "1.0.0")] | ||
pub use self::rwlock::{RwLock, RwLockReadGuard, RwLockWriteGuard}; | ||
#[doc(inline)] | ||
#[expect(deprecated)] | ||
pub use default_poison_flavor::ONCE_INIT; | ||
#[unstable(feature = "mapped_lock_guards", issue = "117108")] | ||
#[doc(inline)] | ||
pub use default_poison_flavor::{MappedMutexGuard, MappedRwLockReadGuard, MappedRwLockWriteGuard}; | ||
|
||
|
||
#[unstable(feature = "mpmc_channel", issue = "126840")] | ||
pub mod mpmc; | ||
pub mod mpsc; | ||
|
||
#[unstable(feature = "sync_poison_mod", issue = "134646")] | ||
pub mod poison; | ||
|
||
mod barrier; | ||
mod condvar; | ||
mod lazy_lock; | ||
mod mutex; | ||
pub(crate) mod once; | ||
mod once_lock; | ||
mod poison; | ||
mod reentrant_lock; | ||
mod rwlock; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this skip just get applied to specific blocks, like in https://github.com/rust-lang/rust/blob/addbd001ec56741829f20a3000892f8620dd0843/library/core/src/unicode/mod.rs? Applying to the whole file would probably make it a bit too easy for things to get messy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then pretty much every block of
use
s would have to be annotated, because otherwiserustfmt
will regroup them.IMO this looks even noisier and less accurate with all the additional attributes and inability to leave two blank lines between the groups (
rustfmt
removes double empty lines).