Auto merge of #92441 - cjgillot:resolve-trait-impl-item, r=matthewjasper
Link impl items to corresponding trait items in late resolver. Hygienically linking trait impl items to declarations in the trait can be done directly by the late resolver. In fact, it is already done to diagnose unknown items. This PR uses this resolution work and stores the `DefId` of the trait item in the HIR. This avoids having to do this resolution manually later. r? `@matthewjasper` Related to #90639. The added `trait_item_id` field can be moved to `ImplItemRef` to be used directly by your PR.
This commit is contained in:
commit
ec4bcaac45
26 changed files with 478 additions and 515 deletions
|
@ -335,7 +335,8 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
|
|||
fn visit_impl_item_ref(&mut self, ii: &'hir ImplItemRef) {
|
||||
// Do not visit the duplicate information in ImplItemRef. We want to
|
||||
// map the actual nodes, not the duplicate ones in the *Ref.
|
||||
let ImplItemRef { id, ident: _, kind: _, span: _, defaultness: _ } = *ii;
|
||||
let ImplItemRef { id, ident: _, kind: _, span: _, defaultness: _, trait_item_def_id: _ } =
|
||||
*ii;
|
||||
|
||||
self.visit_nested_impl_item(id);
|
||||
}
|
||||
|
|
|
@ -925,6 +925,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
|||
}
|
||||
AssocItemKind::MacCall(..) => unimplemented!(),
|
||||
},
|
||||
trait_item_def_id: self.resolver.get_partial_res(i.id).map(|r| r.base_res().def_id()),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue