]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Insert crate name in canonical path
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Mon, 10 Mar 2025 15:05:18 +0000 (16:05 +0100)
committerArthur Cohen <arthur.cohen@embecosm.com>
Mon, 24 Mar 2025 12:07:25 +0000 (13:07 +0100)
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

index 628b8c5b6fe83ee9eb872239888962a0680f87a0..59142a4094cdce18deb0b39219237de4e37b1a4a 100644 (file)
@@ -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);