4 ms·
> isn't it just mutability with different syntax then? For one thing, in order to take a mutable reference to a binding, that binding must be declared as `mut`
by kibwen 10y ago
> isn't it just mutability with different syntax then?
For one thing, in order to take a mutable reference to a binding, that binding must be declared as `mut`.
let mut a = 2;
let b = 3;
let x = &mut a;
// let y = &mut b; // error: cannot borrow immutable local variable `b` as mutable