[gcc r17-3065] gccrs: Merge binding map when merging nr contexts

Arthur Cohen via Gcc-cvs <[email protected]>
Newsgroups gmane.comp.gcc.cvs
Message-ID <[email protected]>
https://gcc.gnu.org/g:e7418168def7bd18e6cc044641eb7f2bff459076

commit r17-3065-ge7418168def7bd18e6cc044641eb7f2bff459076
Author: Pierre-Emmanuel Patry <[email protected]>
Date:   Fri Jun 26 13:02:10 2026 +0200

    gccrs: Merge binding map when merging nr contexts
    
    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 <[email protected]>

Diff:
---
 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 89c724a2f414..07b8c163c198 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);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.