Track whether an assoc item is in a trait impl or an inherent impl
This commit is contained in:
parent
502d57cb78
commit
7cdc456727
14 changed files with 151 additions and 68 deletions
|
@ -1318,7 +1318,9 @@ impl WalkItemKind for ItemKind {
|
|||
visit_polarity(vis, polarity);
|
||||
visit_opt(of_trait, |trait_ref| vis.visit_trait_ref(trait_ref));
|
||||
vis.visit_ty(self_ty);
|
||||
items.flat_map_in_place(|item| vis.flat_map_assoc_item(item, AssocCtxt::Impl));
|
||||
items.flat_map_in_place(|item| {
|
||||
vis.flat_map_assoc_item(item, AssocCtxt::Impl { of_trait: of_trait.is_some() })
|
||||
});
|
||||
}
|
||||
ItemKind::Trait(box Trait { safety, is_auto: _, generics, bounds, items }) => {
|
||||
visit_safety(vis, safety);
|
||||
|
|
|
@ -23,7 +23,7 @@ use crate::ptr::P;
|
|||
#[derive(Copy, Clone, Debug, PartialEq)]
|
||||
pub enum AssocCtxt {
|
||||
Trait,
|
||||
Impl,
|
||||
Impl { of_trait: bool },
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq)]
|
||||
|
@ -422,7 +422,12 @@ impl WalkItemKind for ItemKind {
|
|||
try_visit!(visitor.visit_generics(generics));
|
||||
visit_opt!(visitor, visit_trait_ref, of_trait);
|
||||
try_visit!(visitor.visit_ty(self_ty));
|
||||
walk_list!(visitor, visit_assoc_item, items, AssocCtxt::Impl);
|
||||
walk_list!(
|
||||
visitor,
|
||||
visit_assoc_item,
|
||||
items,
|
||||
AssocCtxt::Impl { of_trait: of_trait.is_some() }
|
||||
);
|
||||
}
|
||||
ItemKind::Struct(struct_definition, generics)
|
||||
| ItemKind::Union(struct_definition, generics) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue