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]>
Tested on x86_64-pc-linux-gnu.
---
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 70ea85be511..5a0cd22b20a 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 1564a83cbeb..697dfd823fa 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.55.0