1
Fork 0

Improve AdtDef interning.

This commit makes `AdtDef` use `Interned`. Much the commit is tedious
changes to introduce getter functions. The interesting changes are in
`compiler/rustc_middle/src/ty/adt.rs`.
This commit is contained in:
Nicholas Nethercote 2022-03-05 07:28:41 +11:00
parent 5f4e067719
commit ca5525d564
169 changed files with 702 additions and 687 deletions

View file

@ -210,7 +210,7 @@ struct SuspensionPoint<'tcx> {
struct TransformVisitor<'tcx> {
tcx: TyCtxt<'tcx>,
state_adt_ref: &'tcx AdtDef,
state_adt_ref: AdtDef<'tcx>,
state_substs: SubstsRef<'tcx>,
// The type of the discriminant in the generator struct
@ -243,11 +243,11 @@ impl<'tcx> TransformVisitor<'tcx> {
val: Operand<'tcx>,
source_info: SourceInfo,
) -> impl Iterator<Item = Statement<'tcx>> {
let kind = AggregateKind::Adt(self.state_adt_ref.did, idx, self.state_substs, None, None);
assert_eq!(self.state_adt_ref.variants[idx].fields.len(), 1);
let kind = AggregateKind::Adt(self.state_adt_ref.did(), idx, self.state_substs, None, None);
assert_eq!(self.state_adt_ref.variant(idx).fields.len(), 1);
let ty = self
.tcx
.type_of(self.state_adt_ref.variants[idx].fields[0].did)
.type_of(self.state_adt_ref.variant(idx).fields[0].did)
.subst(self.tcx, self.state_substs);
expand_aggregate(
Place::return_place(),