-
Notifications
You must be signed in to change notification settings - Fork 13k
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
UnsafeCell::into_inner should not be unsafe #35067
Comments
For reference the PR which added it is #12686 |
Someone thought about it enough to document the rationale:
Has something changed to make this consideration unnecessary or do you have an explanation of why the reasoning is faulty? |
@durka Because the function takes |
Although this isn't backwards-compatible let x: unsafe fn(_) -> _ = UnsafeCell::<u32>::into_inner; there is some prior art of going unsafe -> safe: |
That's weird, it seems like you ought to be able to assign a safe fn to an On Wed, Jul 27, 2016 at 3:38 PM, Nicole Mazzuca notifications@github.com
|
We removed the subtyping relation at some point; it does seem like a coercion would be (probably) ok, but that would still not be (strictly) backwards compatible. |
(I tend to agree that |
We could always do a crater run just to be absolutely sure nobody is turning |
HI ! Any news on this one ? |
No change that I know of. |
This fixes rust-lang#35067. It will require a Crater run as discussed in that issue.
Make UnsafeCell::into_inner safe This fixes #35067. It will require a Crater run as discussed in that issue.
FWIW the relevant coercion was added in #37389. |
Make UnsafeCell::into_inner safe This fixes #35067. It will require a Crater run as discussed in that issue.
Make UnsafeCell::into_inner safe This fixes #35067. It will require a Crater run as discussed in that issue.
This change is breaking my crate. If I add the |
@asomers Use |
Yeah, that's what I'm doing for now. It seems kind of lame, though. But it does work. |
- Lifetime bounds in generic parameters of a type are now inferred. - `std::cell::UnsafeCell::into_inner` is no longer `unsafe`: <rust-lang/rust#35067>
It's been unsafe since 2014 when it was called
unwrap
. Nobody thought about it, I guess, but it shouldn't be unsafe.The text was updated successfully, but these errors were encountered: