error[E0595]: closure cannot assign to immutable local variable `n` --> $DIR/unboxed-closures-mutate-upvar.rs:14:27 | LL | let n = 0; | - help: make this binding mutable: `mut n` LL | let mut f = to_fn_mut(|| { | ^^ cannot borrow mutably error[E0594]: cannot assign to captured outer variable in an `FnMut` closure --> $DIR/unboxed-closures-mutate-upvar.rs:32:9 | LL | let n = 0; | - help: consider making `n` mutable: `mut n` ... LL | n += 1; | ^^^^^^ error[E0594]: cannot assign to captured outer variable in an `Fn` closure --> $DIR/unboxed-closures-mutate-upvar.rs:46:9 | LL | n += 1; | ^^^^^^ | = note: `Fn` closures cannot capture their enclosing environment for modifications help: consider changing this closure to take self by mutable reference --> $DIR/unboxed-closures-mutate-upvar.rs:45:23 | LL | let mut f = to_fn(move || { | _______________________^ LL | | n += 1; LL | | }); | |_____^ error[E0594]: cannot assign to captured outer variable in an `Fn` closure --> $DIR/unboxed-closures-mutate-upvar.rs:53:9 | LL | n += 1; | ^^^^^^ | = note: `Fn` closures cannot capture their enclosing environment for modifications help: consider changing this closure to take self by mutable reference --> $DIR/unboxed-closures-mutate-upvar.rs:52:23 | LL | let mut f = to_fn(move || { | _______________________^ LL | | n += 1; LL | | }); | |_____^ error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0595`.