[gcc r14-7404] gccrs: resolver: Allow SimplePath to resolve to their root segment

Arthur Cohen cohenarthur@gcc.gnu.org
Tue Jan 16 17:31:48 GMT 2024


https://gcc.gnu.org/g:fe00e3591111b19af779799a73bfb894c6f900ad

commit r14-7404-gfe00e3591111b19af779799a73bfb894c6f900ad
Author: Arthur Cohen <arthur.cohen@embecosm.com>
Date:   Tue Mar 28 13:55:19 2023 +0200

    gccrs: resolver: Allow SimplePath to resolve to their root segment
    
    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.

Diff:
---
 gcc/rust/resolve/rust-ast-resolve-path.cc | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gcc/rust/resolve/rust-ast-resolve-path.cc b/gcc/rust/resolve/rust-ast-resolve-path.cc
index 9c3a2eeace0..38e18bbbef0 100644
--- a/gcc/rust/resolve/rust-ast-resolve-path.cc
+++ b/gcc/rust/resolve/rust-ast-resolve-path.cc
@@ -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;
 	}


More information about the Gcc-cvs mailing list