-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Remove 'static
bound from sync::mpsc, Mutex and RwLock.
#22574
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
Conversation
r? @aturon (rust_highfive has picked a reviewer for you, use r? to override) |
9eaf9a0
to
299cdc9
Compare
This commit removes many unnecessary `unsafe impl` blocks as well as pushing the needed implementations to the lowest level possible. I noticed that the bounds for `RwLock` are a little off when reviewing rust-lang#22574 and wanted to ensure that we had our story straight on these implementations.
@@ -64,8 +64,8 @@ pub struct RwLock<T> { | |||
data: UnsafeCell<T>, | |||
} | |||
|
|||
unsafe impl<T:'static+Send> Send for RwLock<T> {} | |||
unsafe impl<T> Sync for RwLock<T> {} |
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.
I'm... a little shocked by this!
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.
I was also surprised that RwLock
previously had such loose bounds, however, I think it was impossible to construct one that didn't satisfy them, so it has probably not mattered (fortunately).
The changes to |
299cdc9
to
1fd17f7
Compare
Ok I talked with @aturon tonight and he agreed that this should be ok. r=me with the new test case to trigger an error in the |
Adds some basic tests to check that the types still catch the most glaring errors that could occur. cc rust-lang#22444.
1fd17f7
to
380d23b
Compare
@bors r=alexcirchton 380d |
⌛ Testing commit 380d23b with merge dcc6ce2... |
Add a basic test that checks that the types catch the most glaring errors that could occur. cc #22444
This commit removes many unnecessary `unsafe impl` blocks as well as pushing the needed implementations to the lowest level possible. I noticed that the bounds for `RwLock` are a little off when reviewing rust-lang#22574 and wanted to ensure that we had our story straight on these implementations.
Add a basic test that checks that the types catch the most glaring
errors that could occur.
cc #22444