[COMMITTED 129/141] gccrs: Insert crate name in canonical path
arthur.cohen@embecosm.com
arthur.cohen@embecosm.com
Mon Mar 24 12:45:52 GMT 2025
From: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
gcc/rust/ChangeLog:
* resolve/rust-forever-stack.hxx: Insert a new segment with the crate's
name as canonical's path prefix.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
---
gcc/rust/resolve/rust-forever-stack.hxx | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/gcc/rust/resolve/rust-forever-stack.hxx b/gcc/rust/resolve/rust-forever-stack.hxx
index 628b8c5b6fe..59142a4094c 100644
--- a/gcc/rust/resolve/rust-forever-stack.hxx
+++ b/gcc/rust/resolve/rust-forever-stack.hxx
@@ -704,7 +704,12 @@ ForeverStack<N>::to_canonical_path (NodeId id) const
return KeepGoing::Yes;
});
- auto path = Resolver::CanonicalPath::create_empty ();
+ auto &mappings = Analysis::Mappings::get ();
+ CrateNum crate_num = mappings.lookup_crate_num (root.id).value ();
+ auto path = Resolver::CanonicalPath::new_seg (
+ root.id, mappings.get_crate_name (crate_num).value ());
+ path.set_crate_num (crate_num);
+
for (const auto &segment : segments)
path = path.append (segment);
--
2.45.2
More information about the Gcc-rust
mailing list