Fix diagnostic that was looking for a PatKind::Struct

Now that fields are first-class HIR nodes, they appear before the struct pat.
This commit is contained in:
Eric Huss 2022-07-30 19:30:15 -07:00
parent c655f17bce
commit 1c70b8669a

View File

@ -927,7 +927,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
),
);
match self.tcx.hir().get(self.tcx.hir().get_parent_node(pat.hir_id)) {
hir::Node::Pat(Pat { kind: hir::PatKind::Struct(..), .. }) => {
hir::Node::PatField(..) => {
e.span_suggestion_verbose(
ident.span.shrink_to_hi(),
"bind the struct field to a different name instead",