https://gcc.gnu.org/g:f4d20fbe6b546aa3028a606043638aeb56fb296f

commit r15-8785-gf4d20fbe6b546aa3028a606043638aeb56fb296f
Author: Pierre-Emmanuel Patry <pierre-emmanuel.pa...@embecosm.com>
Date:   Tue Feb 4 13:53:30 2025 +0100

    gccrs: Add warning about default visitor usage
    
    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>

Diff:
---
 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 4c6664f104b4..305286970c7f 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);
   };

Reply via email to