Commit a231865
committed
Auto merge of rust-lang#99959 - cuviper:niche-size, r=eddyb
Fix the size of niche enums with ZST alignment
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 rust-lang#99836
r? `@eddyb`File tree
3 files changed
+477
-2
lines changed- compiler/rustc_middle/src/ty
- src/test/ui/layout
3 files changed
+477
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1231 | 1231 | | |
1232 | 1232 | | |
1233 | 1233 | | |
1234 | | - | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
1235 | 1237 | | |
1236 | 1238 | | |
1237 | 1239 | | |
1238 | | - | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
1239 | 1243 | | |
1240 | 1244 | | |
1241 | 1245 | | |
| |||
1249 | 1253 | | |
1250 | 1254 | | |
1251 | 1255 | | |
| 1256 | + | |
| 1257 | + | |
1252 | 1258 | | |
1253 | 1259 | | |
1254 | 1260 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
0 commit comments