fork/rust

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

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
1.5 KiB43 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 | fn to_fn<A:std::marker::Tuple,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   |                 ----- ------- in this closure
36   |                 |
37   |                 expects `Fn` instead of `FnMut`
38LL |         n += 1;
39   |         ^^^^^^ cannot assign
40
41error: aborting due to 4 previous errors
42
43For more information about this error, try `rustc --explain E0594`.