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

@rust-highfive rust-highfive commented Aug 28, 2018

r? @Kimundi

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

@RalfJung
Copy link
Member Author

@RalfJung RalfJung commented Aug 28, 2018

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 label Aug 28, 2018
@kennytm kennytm added the relnotes label Aug 28, 2018
@Centril
Copy link
Contributor

@Centril 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 TimNN commented Sep 4, 2018

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

@alexcrichton
Copy link
Member

@alexcrichton alexcrichton commented Sep 4, 2018

@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 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
Copy link

@rfcbot rfcbot commented Sep 5, 2018

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

@rfcbot
Copy link

@rfcbot rfcbot commented Sep 15, 2018

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

@varkor
Copy link
Member

@varkor varkor commented Sep 15, 2018

@bors r=alexcrichton

@bors
Copy link
Contributor

@bors bors commented Sep 15, 2018

📌 Commit f4f1140 has been approved by alexcrichton

@bors bors added S-waiting-on-bors and removed S-blocked labels Sep 15, 2018
@bors
Copy link
Contributor

@bors bors commented Sep 15, 2018

Testing commit f4f1140 with merge 4fdb0ab...

bors added a commit that referenced this pull request Sep 15, 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.
@eddyb
Copy link
Member

@eddyb eddyb commented Sep 15, 2018

@bors retry (prioritizing #54116)

@bors
Copy link
Contributor

@bors bors commented Sep 15, 2018

Testing commit f4f1140 with merge 447fd25...

bors added a commit that referenced this pull request Sep 15, 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.
@eddyb
Copy link
Member

@eddyb 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 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 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 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
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
@RalfJung RalfJung deleted the RalfJung:slice_align_to branch Nov 9, 2018
@glandium
Copy link
Contributor

@glandium 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
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

You can’t perform that action at this time.