-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
atomic intrinsics should take unsafe pointers not borrowed pointers #6314
Comments
@brson I'd like to take a stab at this. |
@mnemotic I did most of the current work on atomics. This change should just require changing typeck/mod.rs to use raw pointers instead of region pointers. You'll also need to update the intrinsics in unstable/intrinsics.rs Finally, if your willing, I have a few issues open for finishing the atomic support, this just means adding the rest of the operations to the types in unstable/atomics.rs. I'm aatch on IRC too, so hit me up if you have any questions. |
I think I disagree with this. There's nothing about atomic ops that break the type system; they are only dangerous in conjunction with unsafe-shared-mutable-state. So you'll already have to have unsafe blocks if you're doing unsafe atomic ops. |
@bblum But what are the use-cases for atomics without shared mutable state? Couldn't you just use normal integers then? |
It is true that they are not good for much when used in otherwise-safe code. But that doesn't make them unsafe in their own right. Sort of like how creating a I suppose they are just the intrinsics, not the interface of the |
Think about it like this: An operation is |
I actually agree with bblum here. There's no reason to make atomic ops unsafe if you already need unsafe code to do unsafe things with them. They're perfectly safe and well-defined. |
Nominating for P-backcompat-libs. |
brson pointed out to me that the intrinsics are not part of the backcompat api, so this never would be P-backcompat-foo. At this point brson also thinks that we do not need to change to *T; the arguments here for leaving as is have convinced him that this bug can be closed. |
These are very unsafe operations. We should not be pretending that they operate on safe pointers.
The text was updated successfully, but these errors were encountered: