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

stabilize slice_align_to #53754

Merged
merged 1 commit into from
Sep 16, 2018
Merged

stabilize slice_align_to #53754

merged 1 commit into from
Sep 16, 2018

Conversation

RalfJung
Copy link
Member

@RalfJung RalfJung commented Aug 28, 2018

This is very hard to implement correctly, and leads to serious bugs when done incorrectly. Moreover, this is needed to be able to run code that opportunistically exploits alignment on miri. So code using align_to/align_to_mut gets the benefit of a well-tested implementation and of being able to run in miri to test for (some kinds of) UB.

This PR also clarifies the guarantee wrt. the middle part being as long as possible. Should the docs say under which circumstances the middle part could be shorter? Currently, that can only happen when running in miri.

@rust-highfive
Copy link
Collaborator

r? @Kimundi

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

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 28, 2018
@RalfJung
Copy link
Member Author

The steps in the tracking issue talk about "adjusting documentation", to what extend does that apply to lib features? I grepped for all uses of the feature flag, and found no more than what this PR removes.

@nagisa nagisa added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Aug 28, 2018
@kennytm kennytm added the relnotes Marks issues that should be documented in the release notes of the next release. label Aug 28, 2018
@Centril
Copy link
Contributor

Centril commented Aug 28, 2018

@RalfJung Historically; what you've done in this PR has been fine (exhibit A: #51511); so I don't think you need to do anything than remove the feature gate from the doctests; which you've done.

@TimNN
Copy link
Contributor

TimNN commented Sep 4, 2018

Ping from triage @Kimundi / @rust-lang/libs: This PR requires your review.

@alexcrichton
Copy link
Member

@rfcbot fcp merge

This seems like a nifty API that would be quite useful in appropriate situations, so seems like a good idea to me to stabilize!

@rfcbot
Copy link

rfcbot commented Sep 4, 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 a majority of reviewers approve (and none object), 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 proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. labels Sep 4, 2018
@rfcbot
Copy link

rfcbot commented Sep 5, 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 Sep 5, 2018
@TimNN TimNN added S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 11, 2018
@rfcbot rfcbot added the finished-final-comment-period The final comment period is finished for this PR / Issue. label Sep 15, 2018
@rfcbot
Copy link

rfcbot commented Sep 15, 2018

The final comment period, with a disposition to merge, as per the review above, is now complete.

@rfcbot rfcbot removed the final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. label Sep 15, 2018
@varkor
Copy link
Member

varkor commented Sep 15, 2018

@bors r=alexcrichton

@bors
Copy link
Contributor

bors commented Sep 15, 2018

📌 Commit f4f1140 has been approved by alexcrichton

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. labels Sep 15, 2018
@bors
Copy link
Contributor

bors commented Sep 15, 2018

⌛ Testing commit f4f1140 with merge 4fdb0ab3a3551a987e1fbfb2f07f7b37974d6f01...

@eddyb
Copy link
Member

eddyb commented Sep 15, 2018

@bors retry (prioritizing #54116)

@bors
Copy link
Contributor

bors commented Sep 15, 2018

⌛ Testing commit f4f1140 with merge 447fd25aaf554abf8c1f18c331d2463cce2ebae8...

@eddyb
Copy link
Member

eddyb commented Sep 16, 2018

Looks like all tests passed (on both Travis and Appveyor) but @bors never noticed.
Could this be related to why the latest nightly was half-uploaded?
cc @rust-lang/infra

@kennytm
Copy link
Member

kennytm commented Sep 16, 2018

@bors retry

Probably caused by the bors re-deploy.

Edit: The homu queue is outdated, gonna synchronize.

@bors
Copy link
Contributor

bors commented Sep 16, 2018

⌛ Testing commit f4f1140 with merge f481987...

bors added a commit that referenced this pull request Sep 16, 2018
stabilize slice_align_to

This is very hard to implement correctly, and leads to [serious bugs](llogiq/bytecount#42) when done incorrectly. Moreover, this is needed to be able to run code that opportunistically exploits alignment on miri. So code using `align_to`/`align_to_mut` gets the benefit of a well-tested implementation *and* of being able to run in miri to test for (some kinds of) UB.

This PR also clarifies the guarantee wrt. the middle part being as long as possible.  Should the docs say under which circumstances the middle part could be shorter? Currently, that can only happen when running in miri.
@bors
Copy link
Contributor

bors commented Sep 16, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: alexcrichton
Pushing f481987 to master...

@bors bors merged commit f4f1140 into rust-lang:master Sep 16, 2018
@RalfJung RalfJung deleted the slice_align_to branch November 9, 2018 15:34
@glandium
Copy link
Contributor

glandium commented Nov 27, 2018

I know this is way too late, but I just found out about this method, and I must say this: it might have been nicer if it had this signature:

fn align_to<U>(&self) -> (&[T], &U, &[T])

which would still have worked for U=[V] (although that would have required specialization, probably)

Edit: although that would actually have had to return Option<(...)>.

@Centril Centril added this to the 1.31 milestone Apr 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. 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.