From 5a2d06037c7e0b0f06543db17b8376b6a6fceeb3 Mon Sep 17 00:00:00 2001 From: Owen Avery Date: Thu, 17 Apr 2025 14:02:45 -0400 Subject: nr2.0: Handle StructPatternFieldIdent gcc/rust/ChangeLog: * resolve/rust-late-name-resolver-2.0.cc (Late::visit): Handle StructPatternFieldIdent. * resolve/rust-late-name-resolver-2.0.h (Late::visit): Likewise. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove entry. Signed-off-by: Owen Avery --- gcc/rust/resolve/rust-late-name-resolver-2.0.cc | 8 ++++++++ gcc/rust/resolve/rust-late-name-resolver-2.0.h | 1 + gcc/testsuite/rust/compile/nr2/exclude | 1 - 3 files changed, 9 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/rust/resolve/rust-late-name-resolver-2.0.cc b/gcc/rust/resolve/rust-late-name-resolver-2.0.cc index c140fa0..6ac249b 100644 --- a/gcc/rust/resolve/rust-late-name-resolver-2.0.cc +++ b/gcc/rust/resolve/rust-late-name-resolver-2.0.cc @@ -173,6 +173,14 @@ Late::visit (AST::IdentifierPattern &identifier) } void +Late::visit (AST::StructPatternFieldIdent &field) +{ + // We do want to ignore duplicated data because some situations rely on it. + std::ignore = ctx.values.insert_shadowable (field.get_identifier (), + field.get_node_id ()); +} + +void Late::visit (AST::SelfParam ¶m) { // handle similar to AST::IdentifierPattern diff --git a/gcc/rust/resolve/rust-late-name-resolver-2.0.h b/gcc/rust/resolve/rust-late-name-resolver-2.0.h index 52079cc..34f3c28 100644 --- a/gcc/rust/resolve/rust-late-name-resolver-2.0.h +++ b/gcc/rust/resolve/rust-late-name-resolver-2.0.h @@ -42,6 +42,7 @@ public: // TODO: Do we need this? // void visit (AST::Method &) override; void visit (AST::IdentifierPattern &) override; + void visit (AST::StructPatternFieldIdent &) override; void visit (AST::SelfParam &) override; // resolutions diff --git a/gcc/testsuite/rust/compile/nr2/exclude b/gcc/testsuite/rust/compile/nr2/exclude index 4772517..5c52a3c 100644 --- a/gcc/testsuite/rust/compile/nr2/exclude +++ b/gcc/testsuite/rust/compile/nr2/exclude @@ -16,7 +16,6 @@ derive_clone_enum3.rs derive-debug1.rs derive-default1.rs derive-eq-invalid.rs -derive-hash1.rs torture/alt_patterns1.rs torture/name_resolve1.rs issue-3568.rs -- cgit v1.1