91. Array parameters stored into a returned struct are taken by value and moved (2026-11-21)
A non-scalar, non-mut parameter that a fn returns as one field of the
tuple or struct it builds (and that nothing else in that return names) is a
C++ by-value parameter, moved into the result. A return f(...) passes each
local it owns, named once in the call, with std::move. Before, such a
parameter was const T& and copied into the result: Rooted.finish copied
six [V] arrays, and bench/trees/root_bench went from 178 MB to 139 MB RSS
with identical output. A parameter used anywhere else in the return, a global,
or a mut argument is never moved from. Test:
a_param_returned_in_a_struct_is_taken_by_value_and_moved_in and the
sunk_params.cp differential program. Reverse: drop scope::sunk_params and
the last_use_call flag; parameters go back to const& plus a copy.