Only store a LocalDefId in hir::Item.

Items are guaranteed to be HIR owner.
This commit is contained in:
Camille GILLOT 2021-01-30 17:47:51 +01:00
parent bd3cd5dbed
commit cebbba081e
86 changed files with 483 additions and 565 deletions

View file

@ -201,7 +201,7 @@ impl<'tcx> SaveContext<'tcx> {
}
pub fn get_item_data(&self, item: &hir::Item<'_>) -> Option<Data> {
let def_id = self.tcx.hir().local_def_id(item.hir_id).to_def_id();
let def_id = item.def_id.to_def_id();
match item.kind {
hir::ItemKind::Fn(ref sig, ref generics, _) => {
let qualname = format!("::{}", self.tcx.def_path_str(def_id));
@ -290,7 +290,11 @@ impl<'tcx> SaveContext<'tcx> {
span: self.span_from_span(item.ident.span),
value: filename.to_string(),
parent: None,
children: m.item_ids.iter().map(|i| id_from_hir_id(i.id, self)).collect(),
children: m
.item_ids
.iter()
.map(|i| id_from_def_id(i.def_id.to_def_id()))
.collect(),
decl_id: None,
docs: self.docs_for_attrs(&item.attrs),
sig: sig::item_signature(item, self),