Fix -Z print-type-sizes and tests.
This was done by sorting the fields by increasing offset; as a consequence, the order of -Z print-type-sizes matches memory order not source order.
This commit is contained in:
parent
025456e8a4
commit
cfe1a776ee
4 changed files with 35 additions and 33 deletions
|
|
@ -142,7 +142,12 @@ impl CodeStats {
|
|||
max_variant_size = cmp::max(max_variant_size, size);
|
||||
|
||||
let mut min_offset = discr_size;
|
||||
for field in fields {
|
||||
|
||||
// We want to print fields by increasing offset.
|
||||
let mut fields = fields.clone();
|
||||
fields.sort_by_key(|f| f.offset);
|
||||
|
||||
for field in fields.iter() {
|
||||
let FieldInfo { ref name, offset, size, align } = *field;
|
||||
|
||||
// Include field alignment in output only if it caused padding injection
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue