Skip to content

Make UnsafeCell::into_inner safe - #47204

Merged
alexcrichton merged 1 commit into
rust-lang:masterfrom
varkor:unsafecell-into_inner-safe
Jan 28, 2018
Merged

Make UnsafeCell::into_inner safe#47204
alexcrichton merged 1 commit into
rust-lang:masterfrom
varkor:unsafecell-into_inner-safe

Conversation

@varkor

Copy link
Copy Markdown
Contributor

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

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

Copy link
Copy Markdown
Contributor

r? @Mark-Simulacrum

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

@kennytmkennytm added S-waiting-on-crater Status: Waiting on a crater run to be completed. T-libs-api [DEPRECATED; DO NOT USE] 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
Copy Markdown
Member

r? @BurntSushi

@bors try

cc @aidanhs for crater

@bors

bors commented Jan 5, 2018

Copy link
Copy Markdown
Collaborator

⌛ 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
Copy Markdown
Member

This shouldn't need a crater anymore since this works now:

let x:unsafefn(_) -> _ = UnsafeCell::<u32>::into_inner;

I added that conversion way back in #37389.

@bors

bors commented Jan 5, 2018

Copy link
Copy Markdown
Collaborator

💔 Test failed - status-travis

@nikomatsakis

Copy link
Copy Markdown
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
Copy Markdown
Member

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

traitFoo{fnbar(&self){}}implFooforunsafefn(){}unsafefnbaz(){}fnmain(){// These do not work:
baz.bar();Foo::bar(&baz);// These do:let x:unsafefn() = baz;
x.bar();Foo::bar(&x);}

@nikomatsakis

Copy link
Copy Markdown
Contributor

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

@carols10cents

Copy link
Copy Markdown
Member

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

@bors try

@kennytm

kennytm commented Jan 10, 2018

Copy link
Copy Markdown
Member

@bors clean retry try

@bors

bors commented Jan 10, 2018

Copy link
Copy Markdown
Collaborator

⌛ 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

bors commented Jan 10, 2018

Copy link
Copy Markdown
Collaborator

💔 Test failed - status-travis

@kennytm

Copy link
Copy Markdown
Member

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

@Mark-Simulacrum

Copy link
Copy Markdown
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-SimulacrumMark-Simulacrum added the relnotes Marks issues that should be documented in the release notes of the next release. label Jan 10, 2018
@alexcrichtonalexcrichton added S-waiting-on-team and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 10, 2018
@alexcrichton

Copy link
Copy Markdown
Member

@rfcbot fcp merge

Curious to see what the libs team thinks!

@rfcbot

rfcbot commented Jan 10, 2018

Copy link
Copy Markdown

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.

@rfcbotrfcbot 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
@rfcbotrfcbot 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
Copy Markdown

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

@rfcbotrfcbot 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
Copy Markdown
Member

@bors: r+

@bors

bors commented Jan 23, 2018

Copy link
Copy Markdown
Collaborator

📌 Commit 4829d50 has been approved by alexcrichton

@bors

bors commented Jan 24, 2018

Copy link
Copy Markdown
Collaborator

⌛ Testing commit 4829d50 with merge ea2b106d7305b530c34266858ecbd55bfcae03b3...

@bors

bors commented Jan 24, 2018

Copy link
Copy Markdown
Collaborator

💔 Test failed - status-travis

@kennytm

kennytm commented Jan 24, 2018

Copy link
Copy Markdown
Member

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

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

@kennytmkennytm 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 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.
@kennytmkennytm added S-blocked Status: 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.
@kennytmkennytm 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: Blocked on something else such as an RFC or other implementation work. labels Jan 28, 2018
@kennytm

Copy link
Copy Markdown
Member

@bors retry

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

@kennytmkennytm 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

bors commented Jan 28, 2018

Copy link
Copy Markdown
Collaborator

⌛ 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

bors commented Jan 28, 2018

Copy link
Copy Markdown
Collaborator

💔 Test failed - status-appveyor

@alexcrichton
alexcrichton merged commit 4829d50 into rust-lang:masterJan 28, 2018
@alexcrichton

Copy link
Copy Markdown
Member

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

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

final-comment-periodIn the final comment period and will be merged soon unless new substantive objections are raised.relnotesMarks issues that should be documented in the release notes of the next release.S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-libs-api[DEPRECATED; DO NOT USE]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UnsafeCell::into_inner should not be unsafe

12 participants

@varkor@rust-highfive@Mark-Simulacrum@bors@cramertj@nikomatsakis@carols10cents@kennytm@alexcrichton@rfcbot@sfackler@BurntSushi