4 ms·
let foo = bar; let foo = bat; is shadowing let foo = bar; foo = bat; is a compilation-time error because foo isn't mutable. let mut foo = bar; foo = bat; i
by empath75 8y ago
let foo = bar;
let foo = bat;
is shadowing
let foo = bar;
foo = bat;
is a compilation-time error because foo isn't mutable.
let mut foo = bar;
foo = bat;
is reassignment.
in working code, either foo is declared as mutable or it's not, and it's pretty obvious from the code what's happening.
- StreamBright 8y agoI guess. I would just never write code like that.
- deleted 8y ago[deleted]