From 5b35fc70550c2327fc1bea2722256ad4362568fb Mon Sep 17 00:00:00 2001 From: Owen Avery Date: Thu, 2 Jan 2025 05:29:03 -0500 Subject: [PATCH] nr2.0: Resolve type aliases inside trait definitions gcc/rust/ChangeLog: * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Add visitor for TraitItemType. * resolve/rust-toplevel-name-resolver-2.0.h (TopLevel::visit): Likewise. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove entries. Signed-off-by: Owen Avery --- gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc | 9 +++++++++ gcc/rust/resolve/rust-toplevel-name-resolver-2.0.h | 1 + gcc/testsuite/rust/compile/nr2/exclude | 5 ----- 3 files changed, 10 insertions(+), 5 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 e51aef8e9d04..369003765563 100644 --- a/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc +++ b/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc @@ -109,6 +109,15 @@ TopLevel::visit (AST::Trait &trait) DefaultResolver::visit (trait); } +void +TopLevel::visit (AST::TraitItemType &trait_item) +{ + insert_or_error_out (trait_item.get_identifier ().as_string (), trait_item, + Namespace::Types); + + DefaultResolver::visit (trait_item); +} + template static void insert_macros (std::vector ¯os, NameResolutionContext &ctx) 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 ce84cd392fea..081ad2ddd829 100644 --- a/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.h +++ b/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.h @@ -148,6 +148,7 @@ class TopLevel : public DefaultResolver void visit (AST::Module &module) override; void visit (AST::Trait &trait) override; + void visit (AST::TraitItemType &trait_item) override; void visit (AST::MacroRulesDefinition ¯o) override; void visit (AST::Function &function) override; void visit (AST::BlockExpr &expr) override; diff --git a/gcc/testsuite/rust/compile/nr2/exclude b/gcc/testsuite/rust/compile/nr2/exclude index 2a5bc94b6463..760fa735f609 100644 --- a/gcc/testsuite/rust/compile/nr2/exclude +++ b/gcc/testsuite/rust/compile/nr2/exclude @@ -74,8 +74,6 @@ issue-2139.rs issue-2142.rs issue-2165.rs issue-2166.rs -issue-2190-1.rs -issue-2190-2.rs issue-2238.rs issue-2304.rs issue-2330.rs @@ -85,7 +83,6 @@ issue-2723-1.rs issue-2723-2.rs issue-2772-2.rs issue-2775.rs -issue-2747.rs issue-2782.rs issue-2812.rs issue-850.rs @@ -98,7 +95,6 @@ macros/mbe/macro-issue1233.rs macros/mbe/macro-issue1400.rs macros/mbe/macro13.rs macros/mbe/macro15.rs -macros/mbe/macro20.rs macros/mbe/macro23.rs macros/mbe/macro40.rs macros/mbe/macro43.rs @@ -198,7 +194,6 @@ iflet.rs issue-3033.rs issue-3009.rs issue-2323.rs -issue-2953-1.rs issue-2953-2.rs issue-1773.rs issue-2905-1.rs