Implicitly deciding between by-value and by-reference could make it harder to reason about the implications caused by Rust’s memory safety checking. Explicitly putting an &
before the parameter lets you know that you can still use the value after passing it to the function (and that it’s not going to be moved):
let x = get_non_copyable_type();
foo(x); // Under this proposal, am I going to be able to
// use `x` after this call? If it’s by reference, then
// yes; otherwise, no.
A type like Vec3
can be used after being passed by value (because it implements Copy
), but most of the time, that’s not the case. Also, if it is Copy
, then you don’t normally need to pass it by reference anyway (and so in this case, probably wouldn’t).