From: Pierre-Emmanuel Patry <[email protected]>
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 <[email protected]>
---
This change was merged into the gccrs repository and is posted here for
upstream visibility and potential drive-by review, as requested by GCC
release managers.
Each commit email contains a link to its details on github from where you can
find the Pull-Request and associated discussions.
Commit on github:
https://github.com/Rust-GCC/gccrs/commit/06575e73b81b2dc403a6f795a356bb48905a79ee
The commit has been mentioned in the following pull-request(s):
- https://github.com/Rust-GCC/gccrs/pull/4425
.../resolve/rust-early-name-resolver-2.0.cc | 24 +------------------
.../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 1ee8e4ac1..a0e31047a 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 e2415dd0c..bd9ccf66d 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
--
2.53.0