https://gcc.gnu.org/g:7567357e178090bf549d4d325b74087b260f9169
commit r15-8852-g7567357e178090bf549d4d325b74087b260f9169 Author: Pierre-Emmanuel Patry <pierre-emmanuel.pa...@embecosm.com> Date: Mon Mar 10 16:05:18 2025 +0100 gccrs: Insert crate name in canonical path 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> Diff: --- 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 628b8c5b6fe8..59142a4094cd 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);