From 9837865042fa3a86e976f178ec90cf92036985b4 Mon Sep 17 00:00:00 2001 From: Owen Avery Date: Tue, 15 Oct 2024 22:10:35 -0400 Subject: [PATCH] Handle const generic parameters during resolution 2.0 gcc/rust/ChangeLog: * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Handle ConstGenericParam. * 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 | 8 ++++++++ gcc/rust/resolve/rust-toplevel-name-resolver-2.0.h | 1 + 2 files changed, 9 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 2bf5ad31013..c4dfdb29f7f 100644 --- a/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc +++ b/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc @@ -286,6 +286,14 @@ TopLevel::visit (AST::TypeParam &type_param) Namespace::Types); } +void +TopLevel::visit (AST::ConstGenericParam &const_param) +{ + insert_or_error_out (const_param.get_name (), const_param, Namespace::Values); + + DefaultResolver::visit (const_param); +} + void TopLevel::visit (AST::TupleStruct &tuple_struct) { 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 d6783583ba4..557fa949b40 100644 --- a/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.h +++ b/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.h @@ -164,6 +164,7 @@ class TopLevel : public DefaultResolver void visit (AST::TypeAlias &type_item) override; void visit (AST::ExternCrate &crate) override; void visit (AST::TypeParam &type_param) override; + void visit (AST::ConstGenericParam &const_param) override; void visit (AST::UseDeclaration &use) override; };