So why did Rust adopt auto-moving instead of explicit moving? If the second example had to be written as foo(move a) there would be no confusion. The and the third example should arguably be sort(mut a.as_mut_slice()).
Personally I would prefer if & in Rust worked similar to const T& in c++ (i.e. for most intents and purposes you can treat a reference as a value), otherwise half of the arguments on each function call will have to be adorned with ampersands. Can we have it such that foo(a) would be guaranteed to not mutate or move a and require "mut" or "move" prefix otherwise?
_______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
