[gccrs COMMIT 10/19] nr2.0: Fix resolve_path_in_all_ns

gerris.rs@gmail.com gerris.rs@gmail.com
Thu Jun 4 13:13:43 GMT 2026


From: Arthur Cohen <arthur.cohen@embecosm.com>

gcc/rust/ChangeLog:

	* resolve/rust-early-name-resolver-2.0.h: Properly insert resolutions in
	the returned vector as that was previously missing.
---
This change was merged into the gccrs repository and is posted here for
upstream visibility and potential drive-by review, as requested by GCC
release managers.
Each commit email contains a link to its details on github from where you can
find the Pull-Request and associated discussions.


Commit on github: https://github.com/Rust-GCC/gccrs/commit/3935080d4574e840e8a197f24331f4208c8cc40f

The commit has NOT been mentioned in any issue.

The commit has been mentioned in the following pull-request(s):
 - https://github.com/Rust-GCC/gccrs/pull/4551

 gcc/rust/resolve/rust-early-name-resolver-2.0.h | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/gcc/rust/resolve/rust-early-name-resolver-2.0.h b/gcc/rust/resolve/rust-early-name-resolver-2.0.h
index 7b1e37722..235595e8d 100644
--- a/gcc/rust/resolve/rust-early-name-resolver-2.0.h
+++ b/gcc/rust/resolve/rust-early-name-resolver-2.0.h
@@ -232,9 +232,14 @@ private:
     std::vector<Error> type_errors;
     std::vector<Error> macro_errors;
 
-    ctx.resolve_path (path, value_errors, Namespace::Values);
-    ctx.resolve_path (path, type_errors, Namespace::Types);
-    ctx.resolve_path (path, macro_errors, Namespace::Macros);
+    auto resolved_fn
+      = [&resolved] (NameResolutionContext::NamespacedDefinition new_def) {
+	  resolved.emplace_back (new_def);
+	};
+
+    ctx.resolve_path (path, value_errors, Namespace::Values).map (resolved_fn);
+    ctx.resolve_path (path, type_errors, Namespace::Types).map (resolved_fn);
+    ctx.resolve_path (path, macro_errors, Namespace::Macros).map (resolved_fn);
 
     if (!value_errors.empty () && !type_errors.empty ()
 	&& !macro_errors.empty ())
-- 
2.54.0



More information about the Gcc-rust mailing list