-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Mark Arc function get_mut and method make_unique unsafe #25908
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
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @huonw (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
I don't want us to sit around with thread unsafe API. I'm sorry I don't know how to fix this, but I can mark it unsafe. Other options:
|
This is a temporary mitigation for issue rust-lang#24880 which points out that these functions are racy in a particular situation where weak pointers exist. To mitigate this, mark the functions unsafe until this can be fixed or another decision is made. This is a breaking change to unstable API, because the new version requires an `unsafe` block. Review carefully if weak pointers may race for any uses of this API and consider abandoning it. [breaking-change]
I don't think stabilizing these as unsafe functions is a good idea, but this seems like a reasonable path forward in the short term since users will at least be aware of what to be careful of. |
Yeah, this is an "honest" adjustment for now. @bors r+ |
📌 Commit 32211e1 has been approved by |
I would also be fine just removing these functions, it's not clear that an implementation is acceptable in terms of performance costs and it's not very useful to have a racy version today. |
@alexcrichton I'm fine either way. It is possible to use these safely for a user who knows they don't use Weak pointers though. |
@bors r- (I'm not too strong-willed on this) |
Oh sorry, to clarify I didn't mean to stop this or anything, just saying if you want to amend to remove the functions outright I would also r+ :) |
I just want to go for it. With this change we are back to “honest” so then we're fine to fix it later. |
Mark Arc function get_mut and method make_unique unsafe This is a temporary mitigation for issue #24880 which points out that these functions are racy in a particular situation where weak pointers exist. To mitigate this, mark the functions unsafe until this can be fixed or another decision is made.
Mark Arc function get_mut and method make_unique unsafe
This is a temporary mitigation for issue #24880 which points out that
these functions are racy in a particular situation where weak pointers
exist.
To mitigate this, mark the functions unsafe until this can be fixed or
another decision is made.