From: Pierre-Emmanuel Patry <pierre-emmanuel.pa...@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.pa...@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

Reply via email to