-
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
[core] Fix a soundness hole in core::sync::Exclusive
#106792
Conversation
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::Exclusive
core::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 onlySync
ifT
isSend
,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 eitherSend
orSync
, and wrapper types likewise can't.The current API would technically allow a wrapper that (correctly) doesn't implement
Send
orSync
to be erroneously moved to another thread. This fixes that soundness hole.Edit: Relevant issue: #98407