-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
remove the T: Sync
requirement for RwLock<T>: Send
#45267
Conversation
That requirement makes sense for containers like `Arc` that don't uniquely own their contents, but `RwLock` is not one of those. This restriction was added in rust-lang@380d23b, but it's not clear why.
r? @aturon (rust_highfive has picked a reviewer for you, use r? to override) |
|
Thanks for the PR! I think this change makes sense as well, especially along the lines of @cuviper's reasoning. I'm curious, though, what's the rationale for this change? Is code not compiling in the wild which should? |
This only came up for me because I was trying to make a table of the |
Hm ok, thanks for the info. In that sense I'd like to be extra careful with this, so to get some more eyes I'll.... @rfcbot fcp merge |
Team member @alexcrichton has proposed to merge this. The next step is review by the rest of the tagged teams: No concerns currently listed. Once these reviewers reach consensus, this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
@alexcrichton Regarding which specific code doesn't compile and should, that would be any code that tries to send a I would still argue for the change to be accepted, for the following reasons:
|
For what it's worth, that commit also changed |
At the time, all of the methods were in |
cc @RalfJung |
Indeed, |
Actually there are some more unnecessary bounds, but they are implicit: |
That is really cool :-D Should I add those removals to this PR, or better to make a separate one? |
📌 Commit fbf6885 has been approved by |
remove the `T: Sync` requirement for `RwLock<T>: Send` That requirement makes sense for containers like `Arc` that don't uniquely own their contents, but `RwLock` is not one of those. This restriction was added in 380d23b, but it's not clear why. @hniksic and I [were discussing this on reddit](https://www.reddit.com/r/rust/comments/763o7r/blog_posts_introducing_lockfree_rust_comparing/dobcvbm/). I might be totally wrong about this change being sound, but I'm super curious to find out :)
☀️ Test successful - status-appveyor, status-travis |
@oconnor663 Feel free to make another PR removing the remaining bounds if you're up to it. :) |
I already did: #45682 |
That requirement makes sense for containers like
Arc
that don'tuniquely own their contents, but
RwLock
is not one of those.This restriction was added in 380d23b, but it's not clear why. @hniksic
and I were discussing this on reddit. I might be totally wrong about this change being sound, but I'm super curious to find out :)