fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #66089 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum4560ea788cb

1.39.0
1.3 KiB44 linesraw
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 |         n += 1;
32   |         ^^^^^^ cannot assign
33   |
34help: consider changing this to accept closures that implement `FnMut`
35  --> $DIR/unboxed-closures-mutate-upvar.rs:52:23
36   |
37LL |       let mut f = to_fn(move || {
38   |  _______________________^
39LL | |         n += 1;
40LL | |     });
41   | |_____^
42
43error: aborting due to 4 previous errors
44