[core] Fix a soundness hole in core::sync::Exclusive#106792
[core] Fix a soundness hole in core::sync::Exclusive#106792dead-claudia wants to merge 1 commit intorust-lang:masterfrom
core::sync::Exclusive#106792Conversation
|
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Mark-Simulacrum (or someone else) soon. Please see the contribution instructions for more information. |
|
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
core::sync::Exclusivecore::sync::Exclusive
70336ec to
278974e
Compare
Just like `Mutex<T>` is only `Sync` if `T` is `Send`, `Exclusive<T>` should contain the same constraints.
|
@rustbot label +T-libs-api -T-libs |
|
The purpose of
For the given example of |
It does not, because |
|
Closed since I can't seem to find a |
Just like
Mutex<T>is onlySyncifTisSend,Exclusive<T>should contain the same constraints.As an example,
sd_journal*instances created per https://www.freedesktop.org/software/systemd/man/sd_journal_open.html# cannot be eitherSendorSync, and wrapper types likewise can't.The current API would technically allow a wrapper that (correctly) doesn't implement
SendorSyncto be erroneously moved to another thread. This fixes that soundness hole.Edit: Relevant issue: #98407