]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: resolver: Allow SimplePath to resolve to their root segment
authorArthur Cohen <arthur.cohen@embecosm.com>
Tue, 28 Mar 2023 11:55:19 +0000 (13:55 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 17:28:39 +0000 (18:28 +0100)
SimplePath are allowed to resolve to their root segment even if it is `crate`
or `super` when checking visibilities. We now have to make sure that this
is allowed everywhere a SimplePath is kept.

gcc/rust/ChangeLog:

* resolve/rust-ast-resolve-path.cc (ResolvePath::resolve_path): Set
resolved_node_id when visiting root segment of SimplePath.

gcc/rust/resolve/rust-ast-resolve-path.cc

index 9c3a2eeace0a0fdf28d8731bbcea7ac2b314094a..38e18bbbef0dae9f15648f9063f0d8f565ff2609 100644 (file)
@@ -283,6 +283,8 @@ ResolvePath::resolve_path (AST::SimplePath *expr)
          previous_resolved_node_id = module_scope_id;
          resolver->insert_resolved_name (segment.get_node_id (),
                                          module_scope_id);
+         resolved_node_id = module_scope_id;
+
          continue;
        }
       else if (segment.is_super_path_seg ())
@@ -298,6 +300,8 @@ ResolvePath::resolve_path (AST::SimplePath *expr)
          previous_resolved_node_id = module_scope_id;
          resolver->insert_resolved_name (segment.get_node_id (),
                                          module_scope_id);
+         resolved_node_id = module_scope_id;
+
          continue;
        }