diff --git a/gcc/rust/resolve/rust-forever-stack.hxx b/gcc/rust/resolve/rust-forever-stack.hxx index 2b628e44aea..be05f528c47 100644 --- a/gcc/rust/resolve/rust-forever-stack.hxx +++ b/gcc/rust/resolve/rust-forever-stack.hxx @@ -638,9 +638,8 @@ tl::optional ForeverStack::dfs_rib (const ForeverStack::Node &starting_point, NodeId to_find) const { - return dfs_node (starting_point, to_find).map ([] (Node &x) -> Rib & { - return x.rib; - }); + return dfs_node (starting_point, to_find) + .map ([] (const Node &x) -> const Rib & { return x.rib; }); } template