You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fn main() {
let mut a = 5;
let adder = |x: int| x + a;
a = 6;
println(fmt!("%d", adder(1)));
}
---
λ rust run 07-mut-local-closure.rs
07-mut-local-closure.rs:4:4: 4:5 warning: value assigned to `a` is never read [-W dead-assignment (default)]
07-mut-local-closure.rs:4 a = 6;
^
warning: no debug symbols in executable (-arch x86_64)
7
Expected behavior: no warning because the variable is read from in the subsequent adder(1) call.