From: Pierre-Emmanuel Patry <pierre-emmanuel.pa...@embecosm.com>

We already lost some time on this unusual pattern, a comment will
hopefully prevent this from happening again.

gcc/rust/ChangeLog:

        * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Add
        warning about current code.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.pa...@embecosm.com>
---
 gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc 
b/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc
index 4c6664f104b..305286970c7 100644
--- a/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc
+++ b/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc
@@ -110,6 +110,8 @@ TopLevel::visit (AST::InherentImpl &impl)
     insert_or_error_out (Identifier ("Self", impl.get_type ().get_locus ()),
                         impl.get_type (), Namespace::Types);
 
+    // We do want to visit with the default visitor instead of default resolver
+    // because we don't want to insert the scope twice.
     AST::DefaultASTVisitor::visit (impl);
   };
 
@@ -123,6 +125,8 @@ TopLevel::visit (AST::TraitImpl &impl)
     insert_or_error_out (Identifier ("Self", impl.get_type ().get_locus ()),
                         impl.get_type (), Namespace::Types);
 
+    // We do want to visit using the default visitor instead of default 
resolver
+    // because we don't want to insert the scope twice.
     AST::DefaultASTVisitor::visit (impl);
   };
 
-- 
2.45.2

Reply via email to