From d222c9356e47765b6872443b9b8d4ed8bf73d085 Mon Sep 17 00:00:00 2001 From: Owen Avery Date: Tue, 15 Oct 2024 23:42:41 -0400 Subject: [PATCH] Handle external static items in toplevel resolver 2.0 gcc/rust/ChangeLog: * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Handle ExternalStaticItem. * resolve/rust-toplevel-name-resolver-2.0.h (TopLevel::visit): Likewise. Signed-off-by: Owen Avery --- gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc | 7 +++++++ gcc/rust/resolve/rust-toplevel-name-resolver-2.0.h | 1 + 2 files changed, 8 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 9a561453d0ee..2193544a6640 100644 --- a/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc +++ b/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc @@ -264,6 +264,13 @@ TopLevel::visit (AST::StaticItem &static_item) Namespace::Values); } +void +TopLevel::visit (AST::ExternalStaticItem &static_item) +{ + insert_or_error_out (static_item.get_identifier ().as_string (), static_item, + Namespace::Values); +} + void TopLevel::visit (AST::StructStruct &struct_item) { diff --git a/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.h b/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.h index 557fa949b402..ce84cd392fea 100644 --- a/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.h +++ b/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.h @@ -152,6 +152,7 @@ class TopLevel : public DefaultResolver void visit (AST::Function &function) override; void visit (AST::BlockExpr &expr) override; void visit (AST::StaticItem &static_item) override; + void visit (AST::ExternalStaticItem &static_item) override; void visit (AST::StructStruct &struct_item) override; void visit (AST::TupleStruct &tuple_struct) override; void visit (AST::EnumItem &variant) override;