]> git.lizzy.rs Git - rust.git/blob - src/test/ui/borrowck/borrow-immutable-upvar-mutation.stderr
Auto merge of #54624 - arielb1:evaluate-outlives, r=nikomatsakis
[rust.git] / src / test / ui / borrowck / borrow-immutable-upvar-mutation.stderr
1 error[E0387]: cannot assign to data in a captured outer variable in an `Fn` closure
2   --> $DIR/borrow-immutable-upvar-mutation.rs:25:27
3    |
4 LL |         let _f = to_fn(|| x = 42); //~ ERROR cannot assign
5    |                           ^^^^^^
6    |
7 help: consider changing this closure to take self by mutable reference
8   --> $DIR/borrow-immutable-upvar-mutation.rs:25:24
9    |
10 LL |         let _f = to_fn(|| x = 42); //~ ERROR cannot assign
11    |                        ^^^^^^^^^
12
13 error[E0387]: cannot borrow data mutably in a captured outer variable in an `Fn` closure
14   --> $DIR/borrow-immutable-upvar-mutation.rs:28:36
15    |
16 LL |         let _g = to_fn(|| set(&mut y)); //~ ERROR cannot borrow
17    |                                    ^
18    |
19 help: consider changing this closure to take self by mutable reference
20   --> $DIR/borrow-immutable-upvar-mutation.rs:28:24
21    |
22 LL |         let _g = to_fn(|| set(&mut y)); //~ ERROR cannot borrow
23    |                        ^^^^^^^^^^^^^^
24
25 error[E0387]: cannot assign to data in a captured outer variable in an `Fn` closure
26   --> $DIR/borrow-immutable-upvar-mutation.rs:31:55
27    |
28 LL |         let _h = to_fn_mut(|| { set(&mut z); to_fn(|| z = 42); }); //~ ERROR cannot assign
29    |                                                       ^^^^^^
30    |
31 help: consider changing this closure to take self by mutable reference
32   --> $DIR/borrow-immutable-upvar-mutation.rs:31:52
33    |
34 LL |         let _h = to_fn_mut(|| { set(&mut z); to_fn(|| z = 42); }); //~ ERROR cannot assign
35    |                                                    ^^^^^^^^^
36
37 error[E0594]: cannot assign to captured outer variable in an `Fn` closure
38   --> $DIR/borrow-immutable-upvar-mutation.rs:37:32
39    |
40 LL |         let _f = to_fn(move || x = 42); //~ ERROR cannot assign
41    |                                ^^^^^^
42    |
43    = note: `Fn` closures cannot capture their enclosing environment for modifications
44 help: consider changing this closure to take self by mutable reference
45   --> $DIR/borrow-immutable-upvar-mutation.rs:37:24
46    |
47 LL |         let _f = to_fn(move || x = 42); //~ ERROR cannot assign
48    |                        ^^^^^^^^^^^^^^
49
50 error[E0596]: cannot borrow captured outer variable in an `Fn` closure as mutable
51   --> $DIR/borrow-immutable-upvar-mutation.rs:40:41
52    |
53 LL |         let _g = to_fn(move || set(&mut y)); //~ ERROR cannot borrow
54    |                                         ^
55    |
56 help: consider changing this closure to take self by mutable reference
57   --> $DIR/borrow-immutable-upvar-mutation.rs:40:24
58    |
59 LL |         let _g = to_fn(move || set(&mut y)); //~ ERROR cannot borrow
60    |                        ^^^^^^^^^^^^^^^^^^^
61
62 error[E0594]: cannot assign to captured outer variable in an `Fn` closure
63   --> $DIR/borrow-immutable-upvar-mutation.rs:43:65
64    |
65 LL |         let _h = to_fn_mut(move || { set(&mut z); to_fn(move || z = 42); }); //~ ERROR cannot assign
66    |                                                                 ^^^^^^
67    |
68    = note: `Fn` closures cannot capture their enclosing environment for modifications
69 help: consider changing this closure to take self by mutable reference
70   --> $DIR/borrow-immutable-upvar-mutation.rs:43:57
71    |
72 LL |         let _h = to_fn_mut(move || { set(&mut z); to_fn(move || z = 42); }); //~ ERROR cannot assign
73    |                                                         ^^^^^^^^^^^^^^
74
75 error: aborting due to 6 previous errors
76
77 Some errors occurred: E0387, E0594, E0596.
78 For more information about an error, try `rustc --explain E0387`.