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

Fix the size of niche enums with ZST alignment #99959

Merged
merged 2 commits into from
Jul 31, 2022

Conversation

cuviper
Copy link
Member

@cuviper cuviper commented Jul 30, 2022

For enums with an aligned ZST variant, like [T; 0], the niche layout
was not computing a sufficient size to be consistent with alignment. Now
we pad that size up to the alignment, and also make sure to only use the
niche variant's ABI when the size and alignment still match.

Fixes #99836
r? @eddyb

For enums with an aligned ZST variant, like `[T; 0]`, the niche layout
was not computing a sufficient size to be consistent with alignment. Now
we pad that size up to the alignment, and also make sure to only use the
niche variant's ABI when the size and alignment still match.
@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jul 30, 2022
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 30, 2022
@cuviper
Copy link
Member Author

cuviper commented Jul 30, 2022

FWIW, #94075 (cc @mikebenfield) also adds the right align_to, but it doesn't have the new ABI check here.

@eddyb
Copy link
Member

eddyb commented Jul 30, 2022

@bors r+ rollup=never Thanks!

@bors
Copy link
Contributor

bors commented Jul 30, 2022

📌 Commit 1e7e745 has been approved by eddyb

It is now in the queue for this repository.

@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-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 30, 2022
@bors
Copy link
Contributor

bors commented Jul 30, 2022

⌛ Testing commit 1e7e745 with merge a231865...

@bors
Copy link
Contributor

bors commented Jul 31, 2022

☀️ Test successful - checks-actions
Approved by: eddyb
Pushing a231865 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jul 31, 2022
@bors bors merged commit a231865 into rust-lang:master Jul 31, 2022
@rustbot rustbot added this to the 1.64.0 milestone Jul 31, 2022
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (a231865): comparison url.

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

This benchmark run did not return any relevant results for this metric.

Cycles

Results
  • Primary benchmarks: 😿 relevant regression found
  • Secondary benchmarks: 😿 relevant regressions found
mean1 max count2
Regressions 😿
(primary)
3.8% 3.8% 1
Regressions 😿
(secondary)
4.1% 5.2% 2
Improvements 🎉
(primary)
N/A N/A 0
Improvements 🎉
(secondary)
N/A N/A 0
All 😿🎉 (primary) 3.8% 3.8% 1

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

@rustbot label: -perf-regression

Footnotes

  1. the arithmetic mean of the percent change

  2. number of relevant changes

@cuviper cuviper deleted the niche-size branch October 15, 2022 00:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compiling ndarray: alignment mismatch between ABI and layout
6 participants