From: Arthur Cohen <[email protected]>

We only want to emit the ones from regular name resolution as otherwise
they will be doubled for the user for no good reason.

gcc/rust/ChangeLog:

        * resolve/rust-name-resolution-context.h:

Co-authored-by: Owen Avery <[email protected]>
---
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/5103d5d21671f50947d77c09f3a942237d6f7cbd

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

 gcc/rust/resolve/rust-name-resolution-context.h | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/gcc/rust/resolve/rust-name-resolution-context.h 
b/gcc/rust/resolve/rust-name-resolution-context.h
index 2d1ce3117..4284ea8de 100644
--- a/gcc/rust/resolve/rust-name-resolution-context.h
+++ b/gcc/rust/resolve/rust-name-resolution-context.h
@@ -592,25 +592,27 @@ public:
     // If it fails, switch to std prelude resolution if it exists
     if (prelude && !resolved)
       {
+       std::vector<Error> ignore_errors = {};
+
        // TODO: Factor this with the above
        switch (ns)
          {
          case Namespace::Values:
            return values.resolve_path (segments, mode,
                                        insert_segment_resolution,
-                                       collect_errors, *prelude);
+                                       ignore_errors, *prelude);
          case Namespace::Types:
            return types.resolve_path (segments, mode,
-                                      insert_segment_resolution,
-                                      collect_errors, *prelude);
+                                      insert_segment_resolution, ignore_errors,
+                                      *prelude);
          case Namespace::Macros:
            return macros.resolve_path (segments, mode,
                                        insert_segment_resolution,
-                                       collect_errors, *prelude);
+                                       ignore_errors, *prelude);
          case Namespace::Labels:
            return labels.resolve_path (segments, mode,
                                        insert_segment_resolution,
-                                       collect_errors, *prelude);
+                                       ignore_errors, *prelude);
          default:
            rust_unreachable ();
          }
-- 
2.52.0

Reply via email to