rust/library/std
Michael Goulet 4a01a38466
Rollup merge of #111087 - ibraheemdev:patch-15, r=dtolnay
Implement `Sync` for `mpsc::Sender`

`mpsc::Sender` is currently `!Sync` because the previous implementation contained an optimization where the channel started out as single-producer and was dynamically upgraded on the first clone, which relied on a unique reference to the sender. This optimization is one of the main reasons the old implementation was so complex and was removed in #93563. `mpsc::Sender` can now soundly implement `Sync`.

Note for any potential confusion, this chance does *not* add MPMC behavior. This only affects the already `Send + Clone` *sender*, not *receiver*.

It's technically possible to rely on the `!Sync` behavior in the same way as a `PhantomData<*mut T>`, but that seems very unlikely in practice. Either way, this change is insta-stable and needs an FCP.

`@rustbot` label +T-libs-api -T-libs
2023-06-23 19:47:19 -07:00
..
benches
primitive_docs
src Rollup merge of #111087 - ibraheemdev:patch-15, r=dtolnay 2023-06-23 19:47:19 -07:00
tests std: mark common functions in test crate pub(crate) 2023-05-25 08:15:04 -07:00
build.rs wip: Support Apple tvOS in libstd 2023-06-21 14:59:37 -07:00
Cargo.toml std: only depend on dlmalloc for wasm*-unknown 2023-06-15 15:56:00 -07:00