On Dec 28, 2013, at 7:10 PM, Vadim <[email protected]> wrote:
> You could have said "Well, I've already declared my variable as mutable, i.e.
> `let mut i = 0`. Since is already mutable, why do I have to say "mut" again
> when borrowing? The compiler could have easily inferred that." I believe
> the answer is "To help readers of this code realize that the called function
> is [most likely] going to mutate the variable". I believe the same logic
> should apply to mut references.
The answer is because &T and &mut T are distinct types, with distinct behavior
(notably, mutable borrows must be unique).
-Kevin
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev