From: Pierre-Emmanuel Patry <[email protected]>

Replace ResolutionPath input with a Rawpath instead of a split vector/
flag couple.

gcc/rust/ChangeLog:

        * resolve/rust-forever-stack.h: Use RawPath as ResolutionPath input.
        * resolve/rust-name-resolution-context.h: Change call site.

Signed-off-by: Pierre-Emmanuel Patry <[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/fec7e5b0cdc40de38c799ea140495b68ff143ad6

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/5044

 gcc/rust/resolve/rust-forever-stack.h           | 9 ++++-----
 gcc/rust/resolve/rust-name-resolution-context.h | 6 ++----
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/gcc/rust/resolve/rust-forever-stack.h 
b/gcc/rust/resolve/rust-forever-stack.h
index 70ea85be5..5a0cd22b2 100644
--- a/gcc/rust/resolve/rust-forever-stack.h
+++ b/gcc/rust/resolve/rust-forever-stack.h
@@ -418,13 +418,12 @@ class ResolutionPath : public 
RawPath<ResolutionPathSegment>
 {
 public:
   template <typename T>
-  ResolutionPath (const std::vector<T> &segments_in,
-                 bool opening_scope_resolution, NodeId node_id)
-    : RawPath ({}, opening_scope_resolution), node_id (node_id)
+  ResolutionPath (const RawPath<T> &path, NodeId node_id)
+    : RawPath ({}, path.has_opening_scope_resolution ()), node_id (node_id)
   {
     segments.clear ();
-    segments.reserve (segments_in.size ());
-    for (auto &outer_seg : segments_in)
+    segments.reserve (path.get_segments ().size ());
+    for (auto &outer_seg : path.get_segments ())
       {
        if (auto lang_item = unwrap_segment_get_lang_item (outer_seg))
          {
diff --git a/gcc/rust/resolve/rust-name-resolution-context.h 
b/gcc/rust/resolve/rust-name-resolution-context.h
index 1564a83cb..697dfd823 100644
--- a/gcc/rust/resolve/rust-name-resolution-context.h
+++ b/gcc/rust/resolve/rust-name-resolution-context.h
@@ -688,8 +688,7 @@ public:
     template <typename S>
     void set_path (const RawPath<S> &new_path, NodeId node_id)
     {
-      path = ResolutionPath (new_path.get_segments (),
-                            new_path.has_opening_scope_resolution (), node_id);
+      path = ResolutionPath (new_path, node_id);
       mode = ResolutionMode::Normal;
       if (new_path.has_opening_scope_resolution ())
        {
@@ -705,8 +704,7 @@ public:
     void set_path (const RawPath<S> &new_path, NodeId node_id,
                   ResolutionMode mode)
     {
-      path = ResolutionPath (new_path.get_segments (),
-                            new_path.has_opening_scope_resolution (), node_id);
+      path = ResolutionPath (new_path, node_id);
       this->mode = mode;
       has_path_set = true;
     }
-- 
2.56.0

Reply via email to