Skip to content

Commit 6029cc9

Browse files
powerboat9P-E-P
authored andcommitted
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 <[email protected]>
1 parent f88af61 commit 6029cc9

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

gcc/rust/resolve/rust-forever-stack.h

+5-2
Original file line numberDiff line numberDiff line change
@@ -547,13 +547,16 @@ template <Namespace N> class ForeverStack
547547
{
548548
public:
549549
ForeverStack ()
550-
// FIXME: Is that valid? Do we use the root? If yes, we should give the
551-
// crate's node id to ForeverStack's constructor
552550
: root (Node (Rib (Rib::Kind::Normal), UNKNOWN_NODEID)),
553551
cursor_reference (root)
554552
{
555553
rust_assert (root.is_root ());
556554
rust_assert (root.is_leaf ());
555+
556+
// TODO: Should we be using the forever stack root as the crate scope?
557+
// TODO: Is this how we should be getting the crate node id?
558+
auto &mappings = Analysis::Mappings::get ();
559+
root.id = *mappings.crate_num_to_nodeid (mappings.get_current_crate ());
557560
}
558561

559562
/**

gcc/rust/resolve/rust-forever-stack.hxx

+1-6
Original file line numberDiff line numberDiff line change
@@ -401,12 +401,7 @@ ForeverStack<N>::find_starting_point (
401401
if (seg.is_crate_path_seg ())
402402
{
403403
starting_point = root;
404-
// TODO: is this how we should be getting the crate node id?
405-
auto &mappings = Analysis::Mappings::get ();
406-
NodeId current_crate
407-
= *mappings.crate_num_to_nodeid (mappings.get_current_crate ());
408-
409-
insert_segment_resolution (outer_seg, current_crate);
404+
insert_segment_resolution (outer_seg, starting_point.get ().id);
410405
iterator++;
411406
break;
412407
}

gcc/testsuite/rust/compile/nr2/exclude

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
break-rust2.rs
22
canonical_paths1.rs
33
cfg1.rs
4-
complex-path1.rs
54
const_generics_3.rs
65
const_generics_4.rs
76
feature_rust_attri0.rs
@@ -29,7 +28,6 @@ pub_restricted_2.rs
2928
pub_restricted_3.rs
3029
redef_error2.rs
3130
redef_error5.rs
32-
self-path1.rs
3331
self-path2.rs
3432
sizeof-stray-infer-var-bug.rs
3533
struct-expr-parse.rs

0 commit comments

Comments
 (0)