]> git.lizzy.rs Git - rust.git/blob - src/test/ui/borrowck/borrow-immutable-upvar-mutation.stderr
Rollup merge of #65613 - Mark-Simulacrum:rustdoc-preserve-ws, r=GuillaumeGomez
[rust.git] / src / test / ui / borrowck / borrow-immutable-upvar-mutation.stderr
1 error[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    |
4 LL |         let _f = to_fn(|| x = 42);
5    |                           ^^^^^^ cannot assign
6    |
7 help: consider changing this to accept closures that implement `FnMut`
8   --> $DIR/borrow-immutable-upvar-mutation.rs:15:24
9    |
10 LL |         let _f = to_fn(|| x = 42);
11    |                        ^^^^^^^^^
12
13 error[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    |
16 LL |         let _g = to_fn(|| set(&mut y));
17    |                               ^^^^^^ cannot borrow as mutable
18    |
19 help: consider changing this to accept closures that implement `FnMut`
20   --> $DIR/borrow-immutable-upvar-mutation.rs:18:24
21    |
22 LL |         let _g = to_fn(|| set(&mut y));
23    |                        ^^^^^^^^^^^^^^
24
25 error[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    |
28 LL |         let _h = to_fn_mut(|| { set(&mut z); to_fn(|| z = 42); });
29    |                                                       ^^^^^^ cannot assign
30    |
31 help: consider changing this to accept closures that implement `FnMut`
32   --> $DIR/borrow-immutable-upvar-mutation.rs:21:52
33    |
34 LL |         let _h = to_fn_mut(|| { set(&mut z); to_fn(|| z = 42); });
35    |                                                    ^^^^^^^^^
36
37 error[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    |
40 LL |         let _f = to_fn(move || x = 42);
41    |                                ^^^^^^ cannot assign
42    |
43 help: consider changing this to accept closures that implement `FnMut`
44   --> $DIR/borrow-immutable-upvar-mutation.rs:27:24
45    |
46 LL |         let _f = to_fn(move || x = 42);
47    |                        ^^^^^^^^^^^^^^
48
49 error[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    |
52 LL |         let _g = to_fn(move || set(&mut y));
53    |                                    ^^^^^^ cannot borrow as mutable
54    |
55 help: consider changing this to accept closures that implement `FnMut`
56   --> $DIR/borrow-immutable-upvar-mutation.rs:30:24
57    |
58 LL |         let _g = to_fn(move || set(&mut y));
59    |                        ^^^^^^^^^^^^^^^^^^^
60
61 error[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    |
64 LL |         let _h = to_fn_mut(move || { set(&mut z); to_fn(move || z = 42); });
65    |                                                                 ^^^^^^ cannot assign
66    |
67 help: consider changing this to accept closures that implement `FnMut`
68   --> $DIR/borrow-immutable-upvar-mutation.rs:33:57
69    |
70 LL |         let _h = to_fn_mut(move || { set(&mut z); to_fn(move || z = 42); });
71    |                                                         ^^^^^^^^^^^^^^
72
73 error: aborting due to 6 previous errors
74
75 Some errors have detailed explanations: E0594, E0596.
76 For more information about an error, try `rustc --explain E0594`.