Commit Message
Arthur Cohen
Jan. 30, 2024, 12:06 p.m. UTC
From: Arthur Cohen <arthur.cohen@embecosm.com>
gcc/rust/ChangeLog:
* resolve/rust-forever-stack.hxx: Do not copy segment when
dereferencing iterator in `find_starting_point`.
---
gcc/rust/resolve/rust-forever-stack.hxx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/rust/resolve/rust-forever-stack.hxx b/gcc/rust/resolve/rust-forever-stack.hxx index 8f0ab66b18b..642135cda85 100644 --- a/gcc/rust/resolve/rust-forever-stack.hxx +++ b/gcc/rust/resolve/rust-forever-stack.hxx @@ -333,7 +333,7 @@ ForeverStack<N>::find_starting_point (const std::vector<S> &segments, for (; !is_last (iterator, segments); iterator++) { - auto seg = *iterator; + auto &seg = *iterator; auto is_self_or_crate = seg.is_crate_path_seg () || seg.is_lower_self_seg ();