]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: nr2.0: Set the node id of the root node
authorOwen Avery <powerboat9.gamer@gmail.com>
Tue, 18 Feb 2025 08:56:33 +0000 (03:56 -0500)
committerArthur Cohen <arthur.cohen@embecosm.com>
Mon, 24 Mar 2025 12:07:13 +0000 (13:07 +0100)
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>
gcc/rust/resolve/rust-forever-stack.h
gcc/rust/resolve/rust-forever-stack.hxx
gcc/testsuite/rust/compile/nr2/exclude

index f1e5e8d2f2d1cfa79c8a05c284a20395bdefcadf..64e8a0f0f2c97ba8f79f4e632a98b5dda6d01d45 100644 (file)
@@ -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 ());
   }
 
   /**
index 9ca8db2c09d34e29d3c6db7d3226e3d27e9491ca..c1407344b523bd004ed763d928ab9d7b8c55da8c 100644 (file)
@@ -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;
        }
index 763387f354883e8f2f0e0e2ddfbf04239d21cc18..e179dc30004b2b62027188129b5158fb55f3f7e3 100644 (file)
@@ -1,7 +1,6 @@
 break-rust2.rs
 canonical_paths1.rs
 cfg1.rs
-complex-path1.rs
 const_generics_3.rs
 const_generics_4.rs
 feature_rust_attri0.rs
@@ -29,7 +28,6 @@ pub_restricted_2.rs
 pub_restricted_3.rs
 redef_error2.rs
 redef_error5.rs
-self-path1.rs
 self-path2.rs
 sizeof-stray-infer-var-bug.rs
 struct-expr-parse.rs