From eb1f1c78926920e2bdc914438592ab98caa19331 Mon Sep 17 00:00:00 2001 From: Pierre-Emmanuel Patry Date: Mon, 6 Jan 2025 15:55:53 +0100 Subject: [PATCH] Resolved item type shall be differentiated later We need to query all namespaces and error out at a later stage if the retrieved item is wrong. gcc/rust/ChangeLog: * typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_path_to_trait): Query all namespaces. Signed-off-by: Pierre-Emmanuel Patry --- gcc/rust/typecheck/rust-hir-trait-resolve.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gcc/rust/typecheck/rust-hir-trait-resolve.cc b/gcc/rust/typecheck/rust-hir-trait-resolve.cc index 03614200ba25..bf9699caed1b 100644 --- a/gcc/rust/typecheck/rust-hir-trait-resolve.cc +++ b/gcc/rust/typecheck/rust-hir-trait-resolve.cc @@ -127,8 +127,10 @@ TraitResolver::resolve_path_to_trait (const HIR::TypePath &path, } else { - ok = resolver->lookup_resolved_type (path.get_mappings ().get_nodeid (), - &ref); + auto path_nodeid = path.get_mappings ().get_nodeid (); + ok = resolver->lookup_resolved_type (path_nodeid, &ref) + || resolver->lookup_resolved_name (path_nodeid, &ref) + || resolver->lookup_resolved_macro (path_nodeid, &ref); } if (!ok)