]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Improve handling of static items in toplevel 2.0
authorOwen Avery <powerboat9.gamer@gmail.com>
Mon, 11 Nov 2024 21:19:44 +0000 (16:19 -0500)
committerArthur Cohen <arthur.cohen@embecosm.com>
Fri, 21 Mar 2025 11:32:56 +0000 (12:32 +0100)
gcc/rust/ChangeLog:

* resolve/rust-toplevel-name-resolver-2.0.cc
(TopLevel::visit): Use DefaultResolver::visit and avoid a call
to Identifier::as_string while handling instances of StaticItem.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc

index ef7a727dae9806a4a7255a8e9830e47080ec886e..a2f695e54f68150fa7231fd81688a9229182704e 100644 (file)
@@ -241,13 +241,10 @@ TopLevel::visit (AST::BlockExpr &expr)
 void
 TopLevel::visit (AST::StaticItem &static_item)
 {
-  auto sub_vis
-    = [this, &static_item] () { static_item.get_expr ().accept_vis (*this); };
-
-  ctx.scoped (Rib::Kind::Item, static_item.get_node_id (), sub_vis);
-
-  insert_or_error_out (static_item.get_identifier ().as_string (), static_item,
+  insert_or_error_out (static_item.get_identifier (), static_item,
                       Namespace::Values);
+
+  DefaultResolver::visit (static_item);
 }
 
 void