Skip to content

Commit

Permalink
Add warning about default visitor usage
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
P-E-P committed Feb 4, 2025
1 parent 4d7e7d9 commit b3bcaeb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};

Expand All @@ -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);
};

Expand Down

0 comments on commit b3bcaeb

Please sign in to comment.