Uh oh!
There was an error while loading. Please reload this page.
rustc: do not raise the alignment of optimized enums to the niche's alignment. - #46809
Merged
Conversation
rust-highfive
commented
Dec 18, 2017
Contributor
r? @estebank (rust_highfive has picked a reviewer for you, use r? to override) |
eddyb
commented
Dec 18, 2017
ContributorAuthor
eddybforce-pushed
the
issue-46769-optimal
branch
from
December 18, 2017 16:34
e612243 to
090a192Comparearielb1
commented
Dec 18, 2017
Contributor
@bors r+ |
bors
commented
Dec 18, 2017
Collaborator
📌 Commit 090a192 has been approved by |
arielb1
commented
Dec 18, 2017
Contributor
@bors r_ |
arielb1
commented
Dec 18, 2017
Contributor
@bors r- |
eddyb
commented
Dec 18, 2017
ContributorAuthor
(don't mind me, just Travis-cycling the PR) |
eddybforce-pushed
the
issue-46769-optimal
branch
from
December 18, 2017 19:58
090a192 to
50b069cComparebors added a commit
that referenced
this pull request
Dec 18, 2017
rustc: ensure optimized enums have a properly aligned size. Fixes#46769 by padding the optimized enums wrapping packed data as necessary. Note that this is not the only way to solve this - on nightly, #46436 makes it easier to fix without adding new padding because of the replacement of `packed` flags with a non-redundant scheme. But because it can't be backported, the optimal fix will be in a separate nightly-only PR (#46809).
kennytm
commented
Dec 19, 2017
Member
#46808 has been merged. |
eddybforce-pushed
the
issue-46769-optimal
branch
from
December 19, 2017 18:58
50b069c to
8fc4afeCompareeddyb
commented
Dec 19, 2017
ContributorAuthor
@bors r=arielb1 |
bors
commented
Dec 19, 2017
Collaborator
📌 Commit 8fc4afe has been approved by |
arielb1
commented
Dec 19, 2017
Contributor
Could you please add a test that the size of a packed enum is what it's supposed to be? @bors r- |
arielb1
commented
Dec 19, 2017
Contributor
Something like this: // This struct has a single niche - the dealigned pointer within. Check that// it is null-pointer-optimized correctlystructInteresting{packed:Packed<&'static()>,other:u8}assert_eq!(mem::size_of::<Interesting>(), mem::size_of::<Option<Interesting>>()); |
eddybforce-pushed
the
issue-46769-optimal
branch
from
December 20, 2017 01:45
8fc4afe to
5c3dcfaCompareeddyb
commented
Dec 20, 2017
ContributorAuthor
@bors r=arielb1 |
bors
commented
Dec 20, 2017
Collaborator
📌 Commit 5c3dcfa has been approved by |
kennytm added a commit
to kennytm/rust
that referenced
this pull request
Dec 21, 2017
rustc: do not raise the alignment of optimized enums to the niche's alignment. This is the improved fix for rust-lang#46769 that does not increase the size of any types (see also rust-lang#46808).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is the improved fix for #46769 that does not increase the size of any types (see also #46808).