[gcc r16-8213] gccrs: Remove duplicated visit within early name res
Arthur Cohen
cohenarthur@gcc.gnu.org
Fri Mar 20 17:25:04 GMT 2026
https://gcc.gnu.org/g:5630bdd16e943f36f3701ce45ae1112a9219eec2
commit r16-8213-g5630bdd16e943f36f3701ce45ae1112a9219eec2
Author: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Date: Tue Feb 24 12:47:24 2026 +0100
gccrs: Remove duplicated visit within early name res
Attribute content was checked twice within the early name resolution,
from outside the attribute and then using the default visitor. Remove
the first one visit. Also fix the wrong locus on trait resolution.
gcc/rust/ChangeLog:
* resolve/rust-early-name-resolver-2.0.cc (Early::visit_derive_attribute):
Change from attribute locus to trait locus.
(Early::visit_attributes): Remove function.
(Early::visit): Remove functions.
* resolve/rust-early-name-resolver-2.0.h: Remove unused prototypes.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Diff:
---
gcc/rust/resolve/rust-early-name-resolver-2.0.cc | 24 +-----------------------
gcc/rust/resolve/rust-early-name-resolver-2.0.h | 4 ----
2 files changed, 1 insertion(+), 27 deletions(-)
diff --git a/gcc/rust/resolve/rust-early-name-resolver-2.0.cc b/gcc/rust/resolve/rust-early-name-resolver-2.0.cc
index 1ee8e4ac19cd..a0e31047a2b5 100644
--- a/gcc/rust/resolve/rust-early-name-resolver-2.0.cc
+++ b/gcc/rust/resolve/rust-early-name-resolver-2.0.cc
@@ -324,8 +324,7 @@ Early::visit_derive_attribute (AST::Attribute &attr,
if (!definition.has_value ())
{
// FIXME: Change to proper error message
- // FIXME: Change locus to trait locus instead of attribute locus
- collect_error (Error (attr.get_locus (),
+ collect_error (Error (trait.get ().get_locus (),
"could not resolve trait %qs",
trait.get ().as_string ().c_str ()));
continue;
@@ -385,27 +384,6 @@ Early::visit (AST::Attribute &attr)
}
}
-void
-Early::visit_attributes (std::vector<AST::Attribute> &attrs)
-{
- for (auto &attr : attrs)
- visit (attr);
-}
-
-void
-Early::visit (AST::Function &fn)
-{
- visit_attributes (fn.get_outer_attrs ());
- DefaultResolver::visit (fn);
-}
-
-void
-Early::visit (AST::StructStruct &s)
-{
- visit_attributes (s.get_outer_attrs ());
- DefaultResolver::visit (s);
-}
-
void
Early::finalize_simple_import (const Early::ImportPair &mapping)
{
diff --git a/gcc/rust/resolve/rust-early-name-resolver-2.0.h b/gcc/rust/resolve/rust-early-name-resolver-2.0.h
index e2415dd0c6d1..bd9ccf66decb 100644
--- a/gcc/rust/resolve/rust-early-name-resolver-2.0.h
+++ b/gcc/rust/resolve/rust-early-name-resolver-2.0.h
@@ -62,8 +62,6 @@ public:
void visit (AST::MacroInvocation &) override;
- void visit (AST::Function &) override;
- void visit (AST::StructStruct &) override;
void visit (AST::UseDeclaration &) override;
void visit (AST::UseTreeList &) override;
@@ -174,8 +172,6 @@ public:
};
private:
- void visit_attributes (std::vector<AST::Attribute> &attrs);
-
/**
* Insert a resolved macro invocation into the mappings once, meaning that we
* can call this function each time the early name resolution pass is underway
More information about the Gcc-cvs
mailing list