1error[E0594]: cannot assign to `n`, as it is not declared as mutable
2  --> $DIR/unboxed-closures-mutate-upvar.rs:15:9
3   |
4LL |     let n = 0;
5   |         - help: consider changing this to be mutable: `mut n`
6LL |     let mut f = to_fn_mut(|| {
7LL |         n += 1;
8   |         ^^^^^^ cannot assign
9
10error[E0594]: cannot assign to `n`, as it is not declared as mutable
11  --> $DIR/unboxed-closures-mutate-upvar.rs:32:9
12   |
13LL |     let n = 0;
14   |         - help: consider changing this to be mutable: `mut n`
15...
16LL |         n += 1;
17   |         ^^^^^^ cannot assign
18
19error[E0594]: cannot assign to `n`, as it is not declared as mutable
20  --> $DIR/unboxed-closures-mutate-upvar.rs:46:9
21   |
22LL |     let n = 0;
23   |         - help: consider changing this to be mutable: `mut n`
24LL |     let mut f = to_fn(move || {
25LL |         n += 1;
26   |         ^^^^^^ cannot assign
27
28error[E0594]: cannot assign to `n`, as it is a captured variable in a `Fn` closure
29  --> $DIR/unboxed-closures-mutate-upvar.rs:53:9
30   |
31LL |   fn to_fn<A,F:Fn<A>>(f: F) -> F { f }
32   |                          - change this to accept `FnMut` instead of `Fn`
33...
34LL |       let mut f = to_fn(move || {
35   |  _________________-----_-
36   | |                 |
37   | |                 expects `Fn` instead of `FnMut`
38LL | |         n += 1;
39   | |         ^^^^^^ cannot assign
40LL | |     });
41   | |_____- in this closure
42
43error: aborting due to 4 previous errors
44
45For more information about this error, try `rustc --explain E0594`.
46