aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/resolve/rust-early-name-resolver-2.0.h
diff options
context:
space:
mode:
authorOwen Avery <powerboat9.gamer@gmail.com>2025-01-04 14:59:54 -0500
committerCohenArthur <arthur.cohen@embecosm.com>2025-02-03 11:44:49 +0000
commit668c3bf7b7b45f8cea7a09515b6420cece877881 (patch)
tree2d7394f4c305d28719615b6d84293337b388fbb9 /gcc/rust/resolve/rust-early-name-resolver-2.0.h
parenta4a3183322dc195b3f235618d28ddca3e320a5fa (diff)
downloadgcc-668c3bf7b7b45f8cea7a09515b6420cece877881.zip
gcc-668c3bf7b7b45f8cea7a09515b6420cece877881.tar.gz
gcc-668c3bf7b7b45f8cea7a09515b6420cece877881.tar.bz2
Fix bug in type resolution of paths
gcc/rust/ChangeLog: * resolve/rust-early-name-resolver-2.0.cc (Early::resolve_glob_import): Use NameResolutionContext::resolve_path instead of ForeverStack::resolve_path. (Early::visit): Likewise. (Early::visit_attributes): Likewise. * resolve/rust-early-name-resolver-2.0.h (Early::resolve_path_in_all_ns): Likewise. * resolve/rust-late-name-resolver-2.0.cc (Late::visit): Likewise, insert segment resolutions not handled by NameResolutionContext::resolve_path, and avoid throwing an error when path resolution could be finished by the typechecker. * resolve/rust-name-resolution-context.h (NameResolutionContext::resolve_path): Add. * typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_root_path): Use segment node ids instead of the path node id to look up segment resolutions when using the 2.0 resolver, as is done with the 1.0 resolver. * typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path): Likewise. * resolve/rust-forever-stack.h (ForeverStack::resolve_path): Add callback parameter for inserting segment resolutions. (ForeverStack::find_starting_point): Likewise. (ForeverStack::resolve_segments): Likewise. * resolve/rust-forever-stack.hxx (ForeverStack::find_starting_point): Likewise. (ForeverStack::resolve_segments): Likewise. (ForeverStack::resolve_path): Likewise and avoid resolving inside TraitOrImpl ribs. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove entries. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
Diffstat (limited to 'gcc/rust/resolve/rust-early-name-resolver-2.0.h')
-rw-r--r--gcc/rust/resolve/rust-early-name-resolver-2.0.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/rust/resolve/rust-early-name-resolver-2.0.h b/gcc/rust/resolve/rust-early-name-resolver-2.0.h
index dd199cc..de14d3c 100644
--- a/gcc/rust/resolve/rust-early-name-resolver-2.0.h
+++ b/gcc/rust/resolve/rust-early-name-resolver-2.0.h
@@ -227,9 +227,12 @@ private:
};
};
- ctx.values.resolve_path (segments).map (pair_with_ns (Namespace::Values));
- ctx.types.resolve_path (segments).map (pair_with_ns (Namespace::Types));
- ctx.macros.resolve_path (segments).map (pair_with_ns (Namespace::Macros));
+ ctx.resolve_path (segments, Namespace::Values)
+ .map (pair_with_ns (Namespace::Values));
+ ctx.resolve_path (segments, Namespace::Types)
+ .map (pair_with_ns (Namespace::Types));
+ ctx.resolve_path (segments, Namespace::Macros)
+ .map (pair_with_ns (Namespace::Macros));
return resolved;
}