Store a DefId
instead of an AdtDef
in AggregateKind::Adt
The `AggregateKind` enum ends up in the final mir `Body`. Currently, any changes to `AdtDef` (regardless of how significant they are) will legitimately cause the overall result of `optimized_mir` to change, invalidating any codegen re-use involving that mir. This will get worse once we start hashing the `Span` inside `FieldDef` (which is itself contained in `AdtDef`). To try to reduce these kinds of invalidations, this commit changes `AggregateKind::Adt` to store just the `DefId`, instead of the full `AdtDef`. This allows the result of `optimized_mir` to be unchanged if the `AdtDef` changes in a way that doesn't actually affect any of the MIR we build.
This commit is contained in:
parent
e100ec5bc7
commit
cac431ba75
11 changed files with 32 additions and 31 deletions
|
@ -377,7 +377,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||
})
|
||||
});
|
||||
let adt = Box::new(AggregateKind::Adt(
|
||||
adt_def,
|
||||
adt_def.did,
|
||||
variant_index,
|
||||
substs,
|
||||
user_ty,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue