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
|
@ -860,7 +860,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
|
|||
this.visit_trait_ref(t);
|
||||
this.visit_ty(self_ty);
|
||||
|
||||
walk_list!(this, visit_assoc_item, items, AssocCtxt::Impl);
|
||||
walk_list!(this, visit_assoc_item, items, AssocCtxt::Impl { of_trait: true });
|
||||
});
|
||||
walk_list!(self, visit_attribute, &item.attrs);
|
||||
return; // Avoid visiting again.
|
||||
|
@ -913,7 +913,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
|
|||
|this| this.visit_generics(generics),
|
||||
);
|
||||
this.visit_ty(self_ty);
|
||||
walk_list!(this, visit_assoc_item, items, AssocCtxt::Impl);
|
||||
walk_list!(this, visit_assoc_item, items, AssocCtxt::Impl { of_trait: false });
|
||||
});
|
||||
walk_list!(self, visit_attribute, &item.attrs);
|
||||
return; // Avoid visiting again.
|
||||
|
@ -1414,7 +1414,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
|
|||
self.check_defaultness(item.span, item.kind.defaultness());
|
||||
}
|
||||
|
||||
if ctxt == AssocCtxt::Impl {
|
||||
if let AssocCtxt::Impl { .. } = ctxt {
|
||||
match &item.kind {
|
||||
AssocItemKind::Const(box ConstItem { expr: None, .. }) => {
|
||||
self.dcx().emit_err(errors::AssocConstWithoutBody {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue