From: Pierre-Emmanuel Patry Date: Mon, 10 Mar 2025 15:05:18 +0000 (+0100) Subject: gccrs: Insert crate name in canonical path X-Git-Tag: basepoints/gcc-16~701 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7567357e178090bf549d4d325b74087b260f9169;p=thirdparty%2Fgcc.git 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 --- 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::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);