aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust
diff options
context:
space:
mode:
authorOwen Avery <powerboat9.gamer@gmail.com>2025-02-18 03:56:33 -0500
committerP-E-P <32375388+P-E-P@users.noreply.github.com>2025-03-10 10:52:37 +0000
commit6029cc9f253124dad3495ee1b681641d588cafb0 (patch)
tree33c598e61217f002f5775778855133234eecdc8b /gcc/rust
parentf88af6176e24e62670f33f3d119db02850c11af2 (diff)
downloadgcc-6029cc9f253124dad3495ee1b681641d588cafb0.zip
gcc-6029cc9f253124dad3495ee1b681641d588cafb0.tar.gz
gcc-6029cc9f253124dad3495ee1b681641d588cafb0.tar.bz2
nr2.0: Set the node id of the root node
gcc/rust/ChangeLog: * resolve/rust-forever-stack.h (ForeverStack::ForeverStack): Set the node id of the root node to that of the current crate. * resolve/rust-forever-stack.hxx (ForeverStack::find_starting_point): Use the node id of the root node during resolution of crate segments. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove entries. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
Diffstat (limited to 'gcc/rust')
-rw-r--r--gcc/rust/resolve/rust-forever-stack.h7
-rw-r--r--gcc/rust/resolve/rust-forever-stack.hxx7
2 files changed, 6 insertions, 8 deletions
diff --git a/gcc/rust/resolve/rust-forever-stack.h b/gcc/rust/resolve/rust-forever-stack.h
index 7bfe651..74944fb 100644
--- a/gcc/rust/resolve/rust-forever-stack.h
+++ b/gcc/rust/resolve/rust-forever-stack.h
@@ -547,13 +547,16 @@ template <Namespace N> class ForeverStack
{
public:
ForeverStack ()
- // FIXME: Is that valid? Do we use the root? If yes, we should give the
- // crate's node id to ForeverStack's constructor
: root (Node (Rib (Rib::Kind::Normal), UNKNOWN_NODEID)),
cursor_reference (root)
{
rust_assert (root.is_root ());
rust_assert (root.is_leaf ());
+
+ // 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 &mappings = Analysis::Mappings::get ();
+ root.id = *mappings.crate_num_to_nodeid (mappings.get_current_crate ());
}
/**
diff --git a/gcc/rust/resolve/rust-forever-stack.hxx b/gcc/rust/resolve/rust-forever-stack.hxx
index 65dd02a..c2b348f 100644
--- a/gcc/rust/resolve/rust-forever-stack.hxx
+++ b/gcc/rust/resolve/rust-forever-stack.hxx
@@ -401,12 +401,7 @@ ForeverStack<N>::find_starting_point (
if (seg.is_crate_path_seg ())
{
starting_point = root;
- // TODO: is this how we should be getting the crate node id?
- auto &mappings = Analysis::Mappings::get ();
- NodeId current_crate
- = *mappings.crate_num_to_nodeid (mappings.get_current_crate ());
-
- insert_segment_resolution (outer_seg, current_crate);
+ insert_segment_resolution (outer_seg, starting_point.get ().id);
iterator++;
break;
}