File tree Expand file tree Collapse file tree 3 files changed +9
-19
lines changed Expand file tree Collapse file tree 3 files changed +9
-19
lines changed Original file line number Diff line number Diff line change @@ -359,13 +359,8 @@ pub trait LayoutCalculator {
359359 // It'll fit, but we need to make some adjustments.
360360 match layout. fields {
361361 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;
369364 }
370365 }
371366 _ => {
@@ -962,11 +957,6 @@ fn univariant(
962957 } ;
963958
964959 (
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 ( ) ,
970960 // Then place largest alignments first.
971961 cmp:: Reverse ( alignment_group_key ( f) ) ,
972962 // 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 {
117117 fields: Arbitrary {
118118 offsets: [
119119 Size(0 bytes),
120- Size(0 bytes),
120+ Size(8 bytes),
121121 Size(4 bytes),
122122 ],
123123 memory_index: [
124- 1,
125124 0,
126125 2,
126+ 1,
127127 ],
128128 },
129129 largest_niche: None,
Original file line number Diff line number Diff line change 11print-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
26print-type-size field `.tagw`: 0 bytes
37print-type-size field `.unit`: 0 bytes
48print-type-size field `.void`: 0 bytes
59print-type-size field `.empty`: 0 bytes
610print-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
1111print-type-size type: `S1`: 8 bytes, alignment: 4 bytes
12- print-type-size field `.tag`: 0 bytes
1312print-type-size field `.x`: 4 bytes
1413print-type-size field `.y`: 4 bytes
14+ print-type-size field `.tag`: 0 bytes
1515print-type-size type: `Empty`: 0 bytes, alignment: 1 bytes
1616print-type-size type: `Void`: 0 bytes, alignment: 1 bytes
You can’t perform that action at this time.
0 commit comments