rustc: do not raise the alignment of optimized enums to the niche's alignment. by eddyb · Pull Request #46809 · rust-lang/rust (original) (raw)
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 andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation14 Commits1 Checks0 Files changed
Conversation
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
[ Show hidden characters]({{ revealButtonHref }})
This is the improved fix for #46769 that does not increase the size of any types (see also #46808).
r? @estebank
(rust_highfive has picked a reviewer for you, use r? to override)
eddyb mentioned this pull request
Status: Blocked on something else such as an RFC or other implementation work.
label
📌 Commit 090a192 has been approved by arielb1
(don't mind me, just Travis-cycling the PR)
bors added a commit that referenced this pull request
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 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
📌 Commit 8fc4afe has been approved by arielb1
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
Could you please add a test that the size of a packed enum is what it's supposed to be?
@bors r-
Something like this:
// This struct has a single niche - the dealigned pointer within. Check that // it is null-pointer-optimized correctly struct Interesting { packed: Packed<&'static ()>, other: u8 }
assert_eq!(mem::size_of::(), mem::size_of::<Option>());
📌 Commit 5c3dcfa has been approved by arielb1
kennytm added a commit to kennytm/rust that referenced this pull request
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).
bors added a commit that referenced this pull request
Rollup of 14 pull requests
- Successful merges: #46636, #46780, #46784, #46809, #46814, #46820, #46839, #46847, #46858, #46878, #46884, #46890, #46898, #46918
- Failed merges:
eddyb deleted the issue-46769-optimal branch
Labels
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.