Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions src/librustc_metadata/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,6 @@ impl<'a, 'tcx> CrateMetadata {
EntryKind::Union(_, _) => ty::AdtKind::Union,
_ => bug!("get_adt_def called on a non-ADT {:?}", did),
};
let mut ctor_index = None;
let variants = if let ty::AdtKind::Enum = kind {
item.children
.decode(self)
Expand All @@ -570,8 +569,7 @@ impl<'a, 'tcx> CrateMetadata {
})
.collect()
} else {
let (variant, struct_ctor) = self.get_variant(&item, item_id, tcx);
ctor_index = struct_ctor;
let (variant, _struct_ctor) = self.get_variant(&item, item_id, tcx);
vec![variant]
};
let (kind, repr) = match item.kind {
Expand All @@ -581,13 +579,7 @@ impl<'a, 'tcx> CrateMetadata {
_ => bug!("get_adt_def called on a non-ADT {:?}", did),
};

let adt = tcx.alloc_adt_def(did, kind, variants, repr);
if let Some(ctor_index) = ctor_index {
// Make adt definition available through constructor id as well.
tcx.maps.adt_def.borrow_mut().insert(self.local_def_id(ctor_index), adt);
}

adt
tcx.alloc_adt_def(did, kind, variants, repr)
}

pub fn get_predicates(&self,
Expand Down
6 changes: 0 additions & 6 deletions src/librustc_typeck/collect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -689,12 +689,6 @@ fn adt_def<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
let node_id = tcx.hir.as_local_node_id(def_id).unwrap();
let item = match tcx.hir.get(node_id) {
NodeItem(item) => item,

// Make adt definition available through constructor id as well.
NodeStructCtor(_) => {
return tcx.lookup_adt_def(tcx.hir.get_parent_did(node_id));
}

_ => bug!()
};

Expand Down