https://gcc.gnu.org/g:3747c952b74e3e30b176849ec7f837a9e134a739
commit r17-5697-g3747c952b74e3e30b176849ec7f837a9e134a739 Author: Pierre-Emmanuel Patry <[email protected]> Date: Mon Aug 17 18:59:12 2026 +0200 gccrs: Assign node id to both prelude We did not assign any node id to neither extern and lang prelude nodes and this was confusing and could lead to unexpected behaviors (duplicate ids). gcc/rust/ChangeLog: * resolve/rust-forever-stack.h: Assign a node id to extern and lang nodes. Signed-off-by: Pierre-Emmanuel Patry <[email protected]> Diff: --- gcc/rust/resolve/rust-forever-stack.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gcc/rust/resolve/rust-forever-stack.h b/gcc/rust/resolve/rust-forever-stack.h index 80ac7a45e5a6..33680141ab23 100644 --- a/gcc/rust/resolve/rust-forever-stack.h +++ b/gcc/rust/resolve/rust-forever-stack.h @@ -597,9 +597,12 @@ public: // TODO: Should we be using the forever stack root as the crate scope? // TODO: Is this how we should be getting the crate node id? - auto &crate_mappings = Analysis::Mappings::get ().crate; + auto &mappings = Analysis::Mappings::get (); + auto &crate_mappings = mappings.crate; root.id = *crate_mappings.crate_num_to_nodeid ( crate_mappings.get_current_crate ()); + extern_prelude.id = mappings.get_next_node_id (); + lang_prelude.id = mappings.get_next_node_id (); } /**
