1
Fork 0

Link impl items to corresponding trait items in late resolver.

This commit is contained in:
Camille GILLOT 2022-01-08 12:22:06 +01:00
parent 488acf86a7
commit 1be6e2d6e9
9 changed files with 114 additions and 162 deletions

View file

@ -2885,6 +2885,8 @@ pub struct ImplItemRef {
pub kind: AssocItemKind,
pub span: Span,
pub defaultness: Defaultness,
/// When we are in a trait impl, link to the trait-item's id.
pub trait_item_def_id: Option<DefId>,
}
#[derive(Copy, Clone, PartialEq, Encodable, Debug, HashStable_Generic)]

View file

@ -1088,7 +1088,8 @@ pub fn walk_foreign_item_ref<'v, V: Visitor<'v>>(
pub fn walk_impl_item_ref<'v, V: Visitor<'v>>(visitor: &mut V, impl_item_ref: &'v ImplItemRef) {
// N.B., deliberately force a compilation error if/when new fields are added.
let ImplItemRef { id, ident, ref kind, span: _, ref defaultness } = *impl_item_ref;
let ImplItemRef { id, ident, ref kind, span: _, ref defaultness, trait_item_def_id: _ } =
*impl_item_ref;
visitor.visit_nested_impl_item(id);
visitor.visit_ident(ident);
visitor.visit_associated_item_kind(kind);