[COMMITTED 07/77] gccrs: Merge binding map when merging nr contexts

arthur.cohen@embecosm.com arthur.cohen@embecosm.com
Fri Aug 7 12:38:58 GMT 2026


From: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>

Name resolution on extern crate did merge the name declarations but not
their usage, this lead to return types within functions not being
recognized anymore. We missed the usage binding during the merge
operation.

gcc/rust/ChangeLog:

	* resolve/rust-name-resolution-context.cc (NameResolutionContext::merge):
	Merge nr usage binding when merging nr contexts.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
---
 gcc/rust/resolve/rust-name-resolution-context.cc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gcc/rust/resolve/rust-name-resolution-context.cc b/gcc/rust/resolve/rust-name-resolution-context.cc
index 89c724a2f41..07b8c163c19 100644
--- a/gcc/rust/resolve/rust-name-resolution-context.cc
+++ b/gcc/rust/resolve/rust-name-resolution-context.cc
@@ -406,6 +406,8 @@ NameResolutionContext::merge (NameResolutionContext &other, NodeId at)
 	    extern_crate_node.rib.insert (name, def);
 	  }
       }
+    stack.resolved_nodes.insert (other_stack.resolved_nodes.begin (),
+				 other_stack.resolved_nodes.end ());
   };
 
   merge_fstack (values, other.values);
-- 
2.50.1



More information about the Gcc-rust mailing list