fork/rust

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

borsAuto merge of #67350 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum73528e339aa

1.40.0
3.1 KiB75 linesraw
1error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure
2  --> $DIR/borrow-immutable-upvar-mutation.rs:15:27
3   |
4LL |         let _f = to_fn(|| x = 42);
5   |                           ^^^^^^ cannot assign
6   |
7help: consider changing this to accept closures that implement `FnMut`
8  --> $DIR/borrow-immutable-upvar-mutation.rs:15:24
9   |
10LL |         let _f = to_fn(|| x = 42);
11   |                        ^^^^^^^^^
12
13error[E0596]: cannot borrow `y` as mutable, as it is a captured variable in a `Fn` closure
14  --> $DIR/borrow-immutable-upvar-mutation.rs:18:31
15   |
16LL |         let _g = to_fn(|| set(&mut y));
17   |                               ^^^^^^ cannot borrow as mutable
18   |
19help: consider changing this to accept closures that implement `FnMut`
20  --> $DIR/borrow-immutable-upvar-mutation.rs:18:24
21   |
22LL |         let _g = to_fn(|| set(&mut y));
23   |                        ^^^^^^^^^^^^^^
24
25error[E0594]: cannot assign to `z`, as it is a captured variable in a `Fn` closure
26  --> $DIR/borrow-immutable-upvar-mutation.rs:21:55
27   |
28LL |         let _h = to_fn_mut(|| { set(&mut z); to_fn(|| z = 42); });
29   |                                                       ^^^^^^ cannot assign
30   |
31help: consider changing this to accept closures that implement `FnMut`
32  --> $DIR/borrow-immutable-upvar-mutation.rs:21:52
33   |
34LL |         let _h = to_fn_mut(|| { set(&mut z); to_fn(|| z = 42); });
35   |                                                    ^^^^^^^^^
36
37error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure
38  --> $DIR/borrow-immutable-upvar-mutation.rs:27:32
39   |
40LL |         let _f = to_fn(move || x = 42);
41   |                                ^^^^^^ cannot assign
42   |
43help: consider changing this to accept closures that implement `FnMut`
44  --> $DIR/borrow-immutable-upvar-mutation.rs:27:24
45   |
46LL |         let _f = to_fn(move || x = 42);
47   |                        ^^^^^^^^^^^^^^
48
49error[E0596]: cannot borrow `y` as mutable, as it is a captured variable in a `Fn` closure
50  --> $DIR/borrow-immutable-upvar-mutation.rs:30:36
51   |
52LL |         let _g = to_fn(move || set(&mut y));
53   |                                    ^^^^^^ cannot borrow as mutable
54   |
55help: consider changing this to accept closures that implement `FnMut`
56  --> $DIR/borrow-immutable-upvar-mutation.rs:30:24
57   |
58LL |         let _g = to_fn(move || set(&mut y));
59   |                        ^^^^^^^^^^^^^^^^^^^
60
61error[E0594]: cannot assign to `z`, as it is a captured variable in a `Fn` closure
62  --> $DIR/borrow-immutable-upvar-mutation.rs:33:65
63   |
64LL |         let _h = to_fn_mut(move || { set(&mut z); to_fn(move || z = 42); });
65   |                                                                 ^^^^^^ cannot assign
66   |
67help: consider changing this to accept closures that implement `FnMut`
68  --> $DIR/borrow-immutable-upvar-mutation.rs:33:57
69   |
70LL |         let _h = to_fn_mut(move || { set(&mut z); to_fn(move || z = 42); });
71   |                                                         ^^^^^^^^^^^^^^
72
73error: aborting due to 6 previous errors
74
75For more information about this error, try `rustc --explain E0596`.