]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Improve handling of ConstantItem during name resolution 2.0
authorOwen Avery <powerboat9.gamer@gmail.com>
Thu, 29 Feb 2024 01:19:04 +0000 (20:19 -0500)
committerArthur Cohen <arthur.cohen@embecosm.com>
Mon, 17 Mar 2025 15:35:30 +0000 (16:35 +0100)
gcc/rust/ChangeLog:

* resolve/rust-default-resolver.cc
(DefaultResolver::visit):
Scope with Rib::Kind::ConstantItem instead
of Rib::Kind::Item.
* resolve/rust-toplevel-name-resolver-2.0.cc
(TopLevel::visit): Remove redundancy in override of
ConstantItem visitor.

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

index 757acfe8595e59431897a707afafdbef62a5e92a..6de694f48f4876864cb07b988fd06cfefb594c13 100644 (file)
@@ -487,7 +487,7 @@ DefaultResolver::visit (AST::ConstantItem &item)
       };
 
       // FIXME: Why do we need a Rib here?
-      ctx.scoped (Rib::Kind::Item, item.get_node_id (), expr_vis);
+      ctx.scoped (Rib::Kind::ConstantItem, item.get_node_id (), expr_vis);
     }
 }
 
index 926ed52036cf50de25185101d587dd618d33bdd8..746b2240d4b7a84331b730b2ffcc8f3270eba981 100644 (file)
@@ -424,10 +424,7 @@ TopLevel::visit (AST::ConstantItem &const_item)
   insert_or_error_out (const_item.get_identifier (), const_item,
                       Namespace::Values);
 
-  auto expr_vis
-    = [this, &const_item] () { const_item.get_expr ().accept_vis (*this); };
-
-  ctx.scoped (Rib::Kind::ConstantItem, const_item.get_node_id (), expr_vis);
+  DefaultResolver::visit (const_item);
 }
 
 bool