[gcc/devel/rust/master] resolver: Allow SimplePath to resolve to their root segment

Thomas Schwinge tschwinge@gcc.gnu.org
Thu Mar 30 06:46:57 GMT 2023


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

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

    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 d8e6f90a9a6..ab93333d770 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