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);

Reply via email to