hir: Drop owner's own item-local id (zero) from parenting tables
This commit is contained in:
parent
99c42d2340
commit
44b3602478
@ -112,7 +112,9 @@ fn with_parent<F: FnOnce(&mut Self)>(&mut self, parent_node_id: HirId, f: F) {
|
||||
}
|
||||
|
||||
fn insert_nested(&mut self, item: LocalDefId) {
|
||||
self.parenting.insert(item, self.parent_node);
|
||||
if self.parent_node.as_u32() != 0 {
|
||||
self.parenting.insert(item, self.parent_node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -174,8 +174,12 @@ pub fn provide(providers: &mut Providers) {
|
||||
let parent_owner_id = tcx.local_def_id_to_hir_id(parent_def_id).owner;
|
||||
HirId {
|
||||
owner: parent_owner_id,
|
||||
local_id: tcx.hir_crate(()).owners[parent_owner_id.def_id].unwrap().parenting
|
||||
[&owner_id.def_id],
|
||||
local_id: tcx.hir_crate(()).owners[parent_owner_id.def_id]
|
||||
.unwrap()
|
||||
.parenting
|
||||
.get(&owner_id.def_id)
|
||||
.copied()
|
||||
.unwrap_or(ItemLocalId::from_u32(0)),
|
||||
}
|
||||
})
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user