rustdoc: Early doc link resolution fixes and refactorings
This commit is contained in:
parent
c2afaba465
commit
69d6c3b2e6
10 changed files with 180 additions and 113 deletions
|
@ -1169,14 +1169,18 @@ 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_def_ids(
|
||||
self,
|
||||
id: DefIndex,
|
||||
sess: &'a Session,
|
||||
) -> impl Iterator<Item = DefId> + 'a {
|
||||
self.root
|
||||
.tables
|
||||
.children
|
||||
.get(self, id)
|
||||
.unwrap_or_else(Lazy::empty)
|
||||
.decode((self, sess))
|
||||
.map(move |child_index| self.local_def_id(child_index))
|
||||
}
|
||||
|
||||
fn get_associated_item(self, id: DefIndex) -> ty::AssocItem {
|
||||
|
|
|
@ -160,7 +160,9 @@ provide! { <'tcx> tcx, def_id, other, cdata,
|
|||
let _ = cdata;
|
||||
tcx.calculate_dtor(def_id, |_,_| Ok(()))
|
||||
}
|
||||
associated_item_def_ids => { cdata.get_associated_item_def_ids(tcx, def_id.index) }
|
||||
associated_item_def_ids => {
|
||||
tcx.arena.alloc_from_iter(cdata.get_associated_item_def_ids(def_id.index, tcx.sess))
|
||||
}
|
||||
associated_item => { cdata.get_associated_item(def_id.index) }
|
||||
inherent_impls => { cdata.get_inherent_implementations_for_type(tcx, def_id.index) }
|
||||
is_foreign_item => { cdata.is_foreign_item(def_id.index) }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue