]> git.lizzy.rs Git - rust.git/blob - src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.nll.stderr
Rollup merge of #57107 - mjbshaw:thread_local_test, r=nikomatsakis
[rust.git] / src / test / ui / unboxed-closures / unboxed-closures-mutate-upvar.nll.stderr
1 error[E0594]: cannot assign to `n`, as it is not declared as mutable
2   --> $DIR/unboxed-closures-mutate-upvar.rs:15:9
3    |
4 LL |     let n = 0;
5    |         - help: consider changing this to be mutable: `mut n`
6 LL |     let mut f = to_fn_mut(|| { //~ ERROR closure cannot assign
7 LL |         n += 1;
8    |         ^^^^^^ cannot assign
9
10 error[E0594]: cannot assign to `n`, as it is not declared as mutable
11   --> $DIR/unboxed-closures-mutate-upvar.rs:32:9
12    |
13 LL |     let n = 0;
14    |         - help: consider changing this to be mutable: `mut n`
15 ...
16 LL |         n += 1; //~ ERROR cannot assign
17    |         ^^^^^^ cannot assign
18
19 error[E0594]: cannot assign to `n`, as it is not declared as mutable
20   --> $DIR/unboxed-closures-mutate-upvar.rs:46:9
21    |
22 LL |     let n = 0;
23    |         - help: consider changing this to be mutable: `mut n`
24 LL |     let mut f = to_fn(move || {
25 LL |         n += 1; //~ ERROR cannot assign
26    |         ^^^^^^ cannot assign
27
28 error[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    |
31 LL |         n += 1; //~ ERROR cannot assign
32    |         ^^^^^^ cannot assign
33    |
34 help: consider changing this to accept closures that implement `FnMut`
35   --> $DIR/unboxed-closures-mutate-upvar.rs:52:23
36    |
37 LL |       let mut f = to_fn(move || {
38    |  _______________________^
39 LL | |         n += 1; //~ ERROR cannot assign
40 LL | |     });
41    | |_____^
42
43 error: aborting due to 4 previous errors
44
45 For more information about this error, try `rustc --explain E0594`.