Check attributes on pattern fields.
Attributes on pattern struct fields were not being checked for validity. This adds the fields as HIR nodes so that the `CheckAttrVisitor` can visit those nodes to check their attributes.
This commit is contained in:
@@ -193,6 +193,11 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
|
||||
|
||||
fn visit_pat(&mut self, pat: &'hir Pat<'hir>) {
|
||||
self.insert(pat.span, pat.hir_id, Node::Pat(pat));
|
||||
if let PatKind::Struct(_, fields, _) = pat.kind {
|
||||
for field in fields {
|
||||
self.insert(field.span, field.hir_id, Node::PatField(field));
|
||||
}
|
||||
}
|
||||
|
||||
self.with_parent(pat.hir_id, |this| {
|
||||
intravisit::walk_pat(this, pat);
|
||||
|
||||
Reference in New Issue
Block a user