Skip to content

Commit a212002

Browse files
cramertjbstrie
authored andcommitted
Remove unused adt-def insertion by constructor DefIndex
1 parent 58c701f commit a212002

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

src/librustc_metadata/decoder.rs

+2-10
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,6 @@ impl<'a, 'tcx> CrateMetadata {
558558
EntryKind::Union(_, _) => ty::AdtKind::Union,
559559
_ => bug!("get_adt_def called on a non-ADT {:?}", did),
560560
};
561-
let mut ctor_index = None;
562561
let variants = if let ty::AdtKind::Enum = kind {
563562
item.children
564563
.decode(self)
@@ -570,8 +569,7 @@ impl<'a, 'tcx> CrateMetadata {
570569
})
571570
.collect()
572571
} else {
573-
let (variant, struct_ctor) = self.get_variant(&item, item_id, tcx);
574-
ctor_index = struct_ctor;
572+
let (variant, _struct_ctor) = self.get_variant(&item, item_id, tcx);
575573
vec![variant]
576574
};
577575
let (kind, repr) = match item.kind {
@@ -581,13 +579,7 @@ impl<'a, 'tcx> CrateMetadata {
581579
_ => bug!("get_adt_def called on a non-ADT {:?}", did),
582580
};
583581

584-
let adt = tcx.alloc_adt_def(did, kind, variants, repr);
585-
if let Some(ctor_index) = ctor_index {
586-
// Make adt definition available through constructor id as well.
587-
tcx.maps.adt_def.borrow_mut().insert(self.local_def_id(ctor_index), adt);
588-
}
589-
590-
adt
582+
tcx.alloc_adt_def(did, kind, variants, repr)
591583
}
592584

593585
pub fn get_predicates(&self,

0 commit comments

Comments
 (0)