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
4 LL | let _f = to_fn(|| x = 42); //~ ERROR cannot assign
7 help: consider changing this closure to take self by mutable reference
8 --> $DIR/borrow-immutable-upvar-mutation.rs:25:24
10 LL | let _f = to_fn(|| x = 42); //~ ERROR cannot assign
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
16 LL | let _g = to_fn(|| set(&mut y)); //~ ERROR cannot borrow
19 help: consider changing this closure to take self by mutable reference
20 --> $DIR/borrow-immutable-upvar-mutation.rs:28:24
22 LL | let _g = to_fn(|| set(&mut y)); //~ ERROR cannot borrow
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
28 LL | let _h = to_fn_mut(|| { set(&mut z); to_fn(|| z = 42); }); //~ ERROR cannot assign
31 help: consider changing this closure to take self by mutable reference
32 --> $DIR/borrow-immutable-upvar-mutation.rs:31:52
34 LL | let _h = to_fn_mut(|| { set(&mut z); to_fn(|| z = 42); }); //~ ERROR cannot assign
37 error[E0594]: cannot assign to captured outer variable in an `Fn` closure
38 --> $DIR/borrow-immutable-upvar-mutation.rs:37:32
40 LL | let _f = to_fn(move || x = 42); //~ ERROR cannot assign
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
47 LL | let _f = to_fn(move || x = 42); //~ ERROR cannot assign
50 error[E0596]: cannot borrow captured outer variable in an `Fn` closure as mutable
51 --> $DIR/borrow-immutable-upvar-mutation.rs:40:41
53 LL | let _g = to_fn(move || set(&mut y)); //~ ERROR cannot borrow
56 help: consider changing this closure to take self by mutable reference
57 --> $DIR/borrow-immutable-upvar-mutation.rs:40:24
59 LL | let _g = to_fn(move || set(&mut y)); //~ ERROR cannot borrow
62 error[E0594]: cannot assign to captured outer variable in an `Fn` closure
63 --> $DIR/borrow-immutable-upvar-mutation.rs:43:65
65 LL | let _h = to_fn_mut(move || { set(&mut z); to_fn(move || z = 42); }); //~ ERROR cannot assign
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
72 LL | let _h = to_fn_mut(move || { set(&mut z); to_fn(move || z = 42); }); //~ ERROR cannot assign
75 error: aborting due to 6 previous errors
77 Some errors occurred: E0387, E0594, E0596.
78 For more information about an error, try `rustc --explain E0387`.