error mutate-immutable
What it means#
A let binding is immutable; only var bindings can be assigned to or mutated through var fn methods and &var borrows (§4.1, §5.1). The same applies to parameters, which are immutable by default.
Example#
fn main() {
let count = 0
count += 1 // <- mutate-immutable
}error
mutate-immutable
How to fix#
fn main() {
var count = 0
count += 1
}Declare the binding with var, or compute a new value with a new let (shadowing is allowed).