From: Pierre-Emmanuel Patry <[email protected]>
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]>
Tested on x86_64-pc-linux-gnu.
---
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 80ac7a45e5a..33680141ab2 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 ();
}
/**
--
2.55.0