Skip to content
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

Make UnsafeCell::into_inner safe #47204

Merged
merged 1 commit into from
Jan 28, 2018

Conversation

varkor
Copy link
Member

@varkor varkor commented Jan 5, 2018

This fixes #35067. It will require a Crater run as discussed in that
issue.

This fixes rust-lang#35067. It will require a Crater run as discussed in that
issue.
@rust-highfive
Copy link
Collaborator

r? @Mark-Simulacrum

(rust_highfive has picked a reviewer for you, use r? to override)

@kennytm kennytm added S-waiting-on-crater Status: Waiting on a crater run to be completed. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-crater Status: Waiting on a crater run to be completed. labels Jan 5, 2018
@Mark-Simulacrum
Copy link
Member

r? @BurntSushi

@bors try

cc @aidanhs for crater

@bors
Copy link
Contributor

bors commented Jan 5, 2018

⌛ Trying commit 4829d50 with merge 68950fc...

bors added a commit that referenced this pull request Jan 5, 2018
Make UnsafeCell::into_inner safe

This fixes #35067. It will require a Crater run as discussed in that
issue.
@cramertj
Copy link
Member

cramertj commented Jan 5, 2018

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.

@bors
Copy link
Contributor

bors commented Jan 5, 2018

💔 Test failed - status-travis

@nikomatsakis
Copy link
Contributor

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 unsafe fn() and so forth.

@cramertj
Copy link
Member

cramertj commented Jan 5, 2018

@nikomatsakis Even then you'd still have to trigger the coercion to unsafe fn() first, wouldn't you? For example:

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);
}

@nikomatsakis
Copy link
Contributor

@cramertj ah, hmm, good point. You may be right. =)

@carols10cents
Copy link
Member

errrrr try failed because of... cargo? I'm going to see if retrying works...

@bors try

@kennytm
Copy link
Member

kennytm commented Jan 10, 2018

@bors clean retry try

@bors
Copy link
Contributor

bors commented Jan 10, 2018

⌛ Trying commit 4829d50 with merge 15e0ec4...

bors added a commit that referenced this pull request Jan 10, 2018
Make UnsafeCell::into_inner safe

This fixes #35067. It will require a Crater run as discussed in that
issue.
@bors
Copy link
Contributor

bors commented Jan 10, 2018

💔 Test failed - status-travis

@kennytm
Copy link
Member

kennytm commented Jan 10, 2018

Nope doesn't work. Cargo needs to add #[allow(unused_unsafe)] for their LazyCell.

@Mark-Simulacrum
Copy link
Member

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?

@Mark-Simulacrum Mark-Simulacrum added the relnotes Marks issues that should be documented in the release notes of the next release. label Jan 10, 2018
@alexcrichton alexcrichton added S-waiting-on-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 10, 2018
@alexcrichton
Copy link
Member

@rfcbot fcp merge

Curious to see what the libs team thinks!

@rfcbot
Copy link

rfcbot commented Jan 10, 2018

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.

@rfcbot rfcbot added the proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. label Jan 10, 2018
@rfcbot rfcbot added the final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. label Jan 23, 2018
@rfcbot
Copy link

rfcbot commented Jan 23, 2018

🔔 This is now entering its final comment period, as per the review above. 🔔

@rfcbot rfcbot removed the proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. label Jan 23, 2018
@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented Jan 23, 2018

📌 Commit 4829d50 has been approved by alexcrichton

@bors
Copy link
Contributor

bors commented Jan 24, 2018

⌛ Testing commit 4829d50 with merge ea2b106d7305b530c34266858ecbd55bfcae03b3...

@bors
Copy link
Contributor

bors commented Jan 24, 2018

💔 Test failed - status-travis

@kennytm
Copy link
Member

kennytm commented Jan 24, 2018

Same error as #47204 (comment), please fix cargo first.

(Triage: Blocked by rust-lang/cargo#4972)

@kennytm kennytm added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). labels Jan 24, 2018
varkor added a commit to varkor/cargo that referenced this pull request Jan 24, 2018
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.
@kennytm kennytm added S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 24, 2018
bors added a commit to rust-lang/cargo that referenced this pull request Jan 24, 2018
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.
@kennytm kennytm added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. labels Jan 28, 2018
@kennytm
Copy link
Member

kennytm commented Jan 28, 2018

@bors retry

The cargo on master contained rust-lang/cargo#4972 already.

@kennytm kennytm added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 28, 2018
@bors
Copy link
Contributor

bors commented Jan 28, 2018

⌛ Testing commit 4829d50 with merge 21882aa...

bors added a commit that referenced this pull request Jan 28, 2018
Make UnsafeCell::into_inner safe

This fixes #35067. It will require a Crater run as discussed in that
issue.
@bors
Copy link
Contributor

bors commented Jan 28, 2018

💔 Test failed - status-appveyor

@alexcrichton alexcrichton merged commit 4829d50 into rust-lang:master Jan 28, 2018
@alexcrichton
Copy link
Member

Er this passed, just a 3 hour timeout, merged manually

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. relnotes Marks issues that should be documented in the release notes of the next release. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UnsafeCell::into_inner should not be unsafe