https://gcc.gnu.org/g:d3a3e52addbe07fed81209a29fe653d840dc67d2
commit r15-8525-gd3a3e52addbe07fed81209a29fe653d840dc67d2 Author: Owen Avery <powerboat9.ga...@gmail.com> Date: Mon Nov 11 16:19:44 2024 -0500 gccrs: Improve handling of static items in toplevel 2.0 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.ga...@gmail.com> Diff: --- gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) 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 ef7a727dae98..a2f695e54f68 100644 --- a/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc +++ b/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc @@ -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