diff options
author | Owen Avery <powerboat9.gamer@gmail.com> | 2024-11-11 16:04:58 -0500 |
---|---|---|
committer | CohenArthur <arthur.cohen@embecosm.com> | 2024-12-09 13:01:42 +0000 |
commit | e6e62d48237016f7a392a80054d84a37a6ff967a (patch) | |
tree | a25769119b059ad3c74f522713b39ccad34f3e67 /gcc | |
parent | 1995c8380836eac0edc02fbb9076fba721577ef2 (diff) | |
download | gcc-e6e62d48237016f7a392a80054d84a37a6ff967a.zip gcc-e6e62d48237016f7a392a80054d84a37a6ff967a.tar.gz gcc-e6e62d48237016f7a392a80054d84a37a6ff967a.tar.bz2 |
Fix ForeverStack::find_starting_point output parameter
gcc/rust/ChangeLog:
* resolve/rust-forever-stack.h
(ForeverStack::find_starting_point): Use type
'std::reference_wrapper<Node> &' instead of 'Node &' for
parameter starting_point.
* resolve/rust-forever-stack.hxx
(ForeverStack::find_starting_point): Likewise.
(ForeverStack::resolve_path): Handle change to
ForeverStack::find_starting_point.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/resolve/rust-forever-stack.h | 3 | ||||
-rw-r--r-- | gcc/rust/resolve/rust-forever-stack.hxx | 13 |
2 files changed, 9 insertions, 7 deletions
diff --git a/gcc/rust/resolve/rust-forever-stack.h b/gcc/rust/resolve/rust-forever-stack.h index 623e256..a05088e 100644 --- a/gcc/rust/resolve/rust-forever-stack.h +++ b/gcc/rust/resolve/rust-forever-stack.h @@ -614,7 +614,8 @@ private: template <typename S> tl::optional<SegIterator<S>> - find_starting_point (const std::vector<S> &segments, Node &starting_point); + find_starting_point (const std::vector<S> &segments, + std::reference_wrapper<Node> &starting_point); template <typename S> tl::optional<Node &> resolve_segments (Node &starting_point, diff --git a/gcc/rust/resolve/rust-forever-stack.hxx b/gcc/rust/resolve/rust-forever-stack.hxx index d49488e..6181c05 100644 --- a/gcc/rust/resolve/rust-forever-stack.hxx +++ b/gcc/rust/resolve/rust-forever-stack.hxx @@ -374,8 +374,8 @@ check_leading_kw_at_start (const S &segment, bool condition) template <Namespace N> template <typename S> tl::optional<typename std::vector<S>::const_iterator> -ForeverStack<N>::find_starting_point (const std::vector<S> &segments, - Node &starting_point) +ForeverStack<N>::find_starting_point ( + const std::vector<S> &segments, std::reference_wrapper<Node> &starting_point) { auto iterator = segments.begin (); @@ -412,14 +412,15 @@ ForeverStack<N>::find_starting_point (const std::vector<S> &segments, } if (seg.is_super_path_seg ()) { - if (starting_point.is_root ()) + if (starting_point.get ().is_root ()) { rust_error_at (seg.get_locus (), ErrorCode::E0433, "too many leading %<super%> keywords"); return tl::nullopt; } - starting_point = find_closest_module (starting_point.parent.value ()); + starting_point + = find_closest_module (starting_point.get ().parent.value ()); continue; } @@ -494,12 +495,12 @@ ForeverStack<N>::resolve_path (const std::vector<S> &segments) if (segments.size () == 1) return get (segments.back ().as_string ()); - auto starting_point = cursor (); + std::reference_wrapper<Node> starting_point = cursor (); return find_starting_point (segments, starting_point) .and_then ([this, &segments, &starting_point] ( typename std::vector<S>::const_iterator iterator) { - return resolve_segments (starting_point, segments, iterator); + return resolve_segments (starting_point.get (), segments, iterator); }) .and_then ([&segments] (Node final_node) { return final_node.rib.get (segments.back ().as_string ()); |