-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Make UnsafeCell::into_inner safe #47204
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
Make UnsafeCell::into_inner safe #47204
Conversation
This fixes rust-lang#35067. It will require a Crater run as discussed in that issue.
(rust_highfive has picked a reviewer for you, use r? to override) |
r? @BurntSushi @bors try cc @aidanhs for crater |
Make UnsafeCell::into_inner safe This fixes #35067. It will require a Crater run as discussed in that issue.
This shouldn't need a crater anymore since this works now: let x: unsafe fn(_) -> _ = UnsafeCell::<u32>::into_inner; I added that conversion way back in #37389. |
💔 Test failed - status-travis |
It still technically needs a crater run. There are other ways to expose the type. e.g. you might have a trait implemented only for |
@nikomatsakis Even then you'd still have to trigger the coercion to trait Foo {
fn bar(&self) {}
}
impl Foo for unsafe fn() {}
unsafe fn baz() {}
fn main() {
// These do not work:
baz.bar();
Foo::bar(&baz);
// These do:
let x: unsafe fn() = baz;
x.bar();
Foo::bar(&x);
} |
@cramertj ah, hmm, good point. You may be right. =) |
errrrr try failed because of... cargo? I'm going to see if retrying works... @bors try |
@bors clean retry try |
Make UnsafeCell::into_inner safe This fixes #35067. It will require a Crater run as discussed in that issue.
💔 Test failed - status-travis |
Nope doesn't work. Cargo needs to add |
This is a breaking change because of the deny(warnings) resulting the compilation failure, though it is minor. We have done this in the past, though (most recently with the ASCII extension traits). @rust-lang/libs: Do we want to do this considering the breaking change aspect? |
@rfcbot fcp merge Curious to see what the libs team thinks! |
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. |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
@bors: r+ |
📌 Commit 4829d50 has been approved by |
⌛ Testing commit 4829d50 with merge ea2b106d7305b530c34266858ecbd55bfcae03b3... |
💔 Test failed - status-travis |
Same error as #47204 (comment), please fix cargo first. (Triage: Blocked by rust-lang/cargo#4972) |
rust-lang/rust#47204 makes `UnsafeCell::into_inner` safe, which means `LazyCell::into_inner` will no longer need an `unsafe` block. `LazyCell` is a blocker for the change in Rust: this fix should allow the change to take place.
Allow unused_unsafe in LazyCell in preparation for lib change rust-lang/rust#47204 makes `UnsafeCell::into_inner` safe, which means `LazyCell::into_inner` will no longer need an `unsafe` block. `LazyCell` is a blocker for the change in Rust: this fix should allow the change to take place.
@bors retry The cargo on master contained rust-lang/cargo#4972 already. |
Make UnsafeCell::into_inner safe This fixes #35067. It will require a Crater run as discussed in that issue.
💔 Test failed - status-appveyor |
Er this passed, just a 3 hour timeout, merged manually |
This fixes #35067. It will require a Crater run as discussed in that
issue.