File tree 3 files changed +9
-19
lines changed
3 files changed +9
-19
lines changed Original file line number Diff line number Diff line change @@ -359,13 +359,8 @@ pub trait LayoutCalculator {
359
359
// It'll fit, but we need to make some adjustments.
360
360
match layout. fields {
361
361
FieldsShape :: Arbitrary { ref mut offsets, .. } => {
362
- for ( j, offset) in offsets. iter_enumerated_mut ( ) {
363
- // keep ZST at offset 0 to simplify Scalar/ScalarPair layout
364
- if !variants[ i] [ j] . 0 . is_zst ( ) {
365
- * offset += this_offset;
366
- } else {
367
- debug_assert_eq ! ( offset. bytes( ) , 0 ) ;
368
- }
362
+ for offset in offsets. iter_mut ( ) {
363
+ * offset += this_offset;
369
364
}
370
365
}
371
366
_ => {
@@ -962,11 +957,6 @@ fn univariant(
962
957
} ;
963
958
964
959
(
965
- // Place ZSTs first to avoid "interesting offsets", especially with only
966
- // one or two non-ZST fields. This helps Scalar/ScalarPair layouts. Note
967
- // that these can ignore even some aligned ZST as long as the alignment
968
- // is less than that of the scalar, hence we treat *all* ZST like that.
969
- !f. 0 . is_zst ( ) ,
970
960
// Then place largest alignments first.
971
961
cmp:: Reverse ( alignment_group_key ( f) ) ,
972
962
// Then prioritize niche placement within alignment group according to
Original file line number Diff line number Diff line change @@ -117,13 +117,13 @@ error: layout_of(S) = Layout {
117
117
fields: Arbitrary {
118
118
offsets: [
119
119
Size(0 bytes),
120
- Size(0 bytes),
120
+ Size(8 bytes),
121
121
Size(4 bytes),
122
122
],
123
123
memory_index: [
124
- 1,
125
124
0,
126
125
2,
126
+ 1,
127
127
],
128
128
},
129
129
largest_niche: None,
Original file line number Diff line number Diff line change 1
1
print-type-size type: `S5<(), Empty>`: 16 bytes, alignment: 4 bytes
2
+ print-type-size field `.w`: 4 bytes
3
+ print-type-size field `.x`: 4 bytes
4
+ print-type-size field `.y`: 4 bytes
5
+ print-type-size field `.z`: 4 bytes
2
6
print-type-size field `.tagw`: 0 bytes
3
7
print-type-size field `.unit`: 0 bytes
4
8
print-type-size field `.void`: 0 bytes
5
9
print-type-size field `.empty`: 0 bytes
6
10
print-type-size field `.tagz`: 0 bytes
7
- print-type-size field `.w`: 4 bytes
8
- print-type-size field `.x`: 4 bytes
9
- print-type-size field `.y`: 4 bytes
10
- print-type-size field `.z`: 4 bytes
11
11
print-type-size type: `S1`: 8 bytes, alignment: 4 bytes
12
- print-type-size field `.tag`: 0 bytes
13
12
print-type-size field `.x`: 4 bytes
14
13
print-type-size field `.y`: 4 bytes
14
+ print-type-size field `.tag`: 0 bytes
15
15
print-type-size type: `Empty`: 0 bytes, alignment: 1 bytes
16
16
print-type-size type: `Void`: 0 bytes, alignment: 1 bytes
You can’t perform that action at this time.
0 commit comments