Deserialization less in associated_item_def_ids
This commit is contained in:
parent
e012a191d7
commit
0b1ab91d66
@ -1258,6 +1258,16 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
fn get_associated_item_def_ids(&self, tcx: TyCtxt<'tcx>, id: DefIndex) -> &'tcx [DefId] {
|
||||
if let Some(children) = self.root.tables.children.get(self, id) {
|
||||
tcx.arena.alloc_from_iter(
|
||||
children.decode((self, tcx.sess)).map(|child_index| self.local_def_id(child_index)),
|
||||
)
|
||||
} else {
|
||||
&[]
|
||||
}
|
||||
}
|
||||
|
||||
fn get_associated_item(&self, id: DefIndex, sess: &Session) -> ty::AssocItem {
|
||||
let def_key = self.def_key(id);
|
||||
let parent = self.local_def_id(def_key.parent.unwrap());
|
||||
|
@ -103,12 +103,7 @@ provide! { <'tcx> tcx, def_id, other, cdata,
|
||||
tcx.calculate_dtor(def_id, |_,_| Ok(()))
|
||||
}
|
||||
variances_of => { tcx.arena.alloc_from_iter(cdata.get_item_variances(def_id.index)) }
|
||||
associated_item_def_ids => {
|
||||
let mut result = SmallVec::<[_; 8]>::new();
|
||||
cdata.each_child_of_item(def_id.index,
|
||||
|child| result.push(child.res.def_id()), tcx.sess);
|
||||
tcx.arena.alloc_slice(&result)
|
||||
}
|
||||
associated_item_def_ids => { cdata.get_associated_item_def_ids(tcx, def_id.index) }
|
||||
associated_item => { cdata.get_associated_item(def_id.index, tcx.sess) }
|
||||
impl_trait_ref => { cdata.get_impl_trait(def_id.index, tcx) }
|
||||
impl_polarity => { cdata.get_impl_polarity(def_id.index) }
|
||||
|
Loading…
x
Reference in New Issue
Block a user