Deserialization less in associated_item_def_ids
This commit is contained in:
parent
e012a191d7
commit
0b1ab91d66
2 changed files with 11 additions and 6 deletions
|
@ -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 {
|
fn get_associated_item(&self, id: DefIndex, sess: &Session) -> ty::AssocItem {
|
||||||
let def_key = self.def_key(id);
|
let def_key = self.def_key(id);
|
||||||
let parent = self.local_def_id(def_key.parent.unwrap());
|
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(()))
|
tcx.calculate_dtor(def_id, |_,_| Ok(()))
|
||||||
}
|
}
|
||||||
variances_of => { tcx.arena.alloc_from_iter(cdata.get_item_variances(def_id.index)) }
|
variances_of => { tcx.arena.alloc_from_iter(cdata.get_item_variances(def_id.index)) }
|
||||||
associated_item_def_ids => {
|
associated_item_def_ids => { cdata.get_associated_item_def_ids(tcx, def_id.index) }
|
||||||
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 => { cdata.get_associated_item(def_id.index, tcx.sess) }
|
associated_item => { cdata.get_associated_item(def_id.index, tcx.sess) }
|
||||||
impl_trait_ref => { cdata.get_impl_trait(def_id.index, tcx) }
|
impl_trait_ref => { cdata.get_impl_trait(def_id.index, tcx) }
|
||||||
impl_polarity => { cdata.get_impl_polarity(def_id.index) }
|
impl_polarity => { cdata.get_impl_polarity(def_id.index) }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue