Skip to content

Commit afdecf4

Browse files
fix: update AST size assertions after enum layout changes
Account for the old bootstrap compiler still seeing the previous Item and ItemKind sizes, while the new compiler sees the smaller layouts produced by the enum layout optimization. Update print-type-size output for enums that now fit in less space. Signed-off-by: Vicente Gusmão <vicente.gusmao@tecnico.ulisboa.pt> Co-authored-by: Miguel Marques <miguel.m.marques@tecnico.ulisboa.pt>
1 parent 1098028 commit afdecf4

2 files changed

Lines changed: 16 additions & 16 deletions

File tree

compiler/rustc_ast/src/ast.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4359,8 +4359,14 @@ mod size_asserts {
43594359
static_assert_size!(GenericBound, 88);
43604360
static_assert_size!(Generics, 40);
43614361
static_assert_size!(Impl, 80);
4362+
#[cfg(bootstrap)]
43624363
static_assert_size!(Item, 152);
4364+
#[cfg(not(bootstrap))]
4365+
static_assert_size!(Item, 144);
4366+
#[cfg(bootstrap)]
43634367
static_assert_size!(ItemKind, 88);
4368+
#[cfg(not(bootstrap))]
4369+
static_assert_size!(ItemKind, 80);
43644370
static_assert_size!(LitKind, 24);
43654371
static_assert_size!(Local, 96);
43664372
static_assert_size!(MetaItemLit, 40);

tests/ui/print_type_sizes/padding.stdout

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
1-
print-type-size type: `E1`: 12 bytes, alignment: 4 bytes
2-
print-type-size discriminant: 1 bytes
3-
print-type-size variant `B`: 11 bytes
4-
print-type-size padding: 3 bytes
5-
print-type-size field `.0`: 8 bytes, alignment: 4 bytes
6-
print-type-size variant `A`: 7 bytes
1+
print-type-size type: `E1`: 8 bytes, alignment: 4 bytes
2+
print-type-size variant `B`: 8 bytes
3+
print-type-size field `.0`: 8 bytes
4+
print-type-size variant `A`: 5 bytes
5+
print-type-size field `.0`: 4 bytes
76
print-type-size field `.1`: 1 bytes
8-
print-type-size padding: 2 bytes
9-
print-type-size field `.0`: 4 bytes, alignment: 4 bytes
10-
print-type-size type: `E2`: 12 bytes, alignment: 4 bytes
11-
print-type-size discriminant: 1 bytes
12-
print-type-size variant `B`: 11 bytes
13-
print-type-size padding: 3 bytes
14-
print-type-size field `.0`: 8 bytes, alignment: 4 bytes
15-
print-type-size variant `A`: 7 bytes
7+
print-type-size type: `E2`: 8 bytes, alignment: 4 bytes
8+
print-type-size variant `B`: 8 bytes
9+
print-type-size field `.0`: 8 bytes
10+
print-type-size variant `A`: 5 bytes
11+
print-type-size field `.1`: 4 bytes
1612
print-type-size field `.0`: 1 bytes
17-
print-type-size padding: 2 bytes
18-
print-type-size field `.1`: 4 bytes, alignment: 4 bytes
1913
print-type-size type: `S`: 8 bytes, alignment: 4 bytes
2014
print-type-size field `.g`: 4 bytes
2115
print-type-size field `.a`: 1 bytes

0 commit comments

Comments
 (0)