error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure --> $DIR/borrow-immutable-upvar-mutation.rs:15:27 | LL | let _f = to_fn(|| x = 42); | ^^^^^^ cannot assign | help: consider changing this to accept closures that implement `FnMut` --> $DIR/borrow-immutable-upvar-mutation.rs:15:24 | LL | let _f = to_fn(|| x = 42); | ^^^^^^^^^ error[E0596]: cannot borrow `y` as mutable, as it is a captured variable in a `Fn` closure --> $DIR/borrow-immutable-upvar-mutation.rs:18:31 | LL | let _g = to_fn(|| set(&mut y)); | ^^^^^^ cannot borrow as mutable | help: consider changing this to accept closures that implement `FnMut` --> $DIR/borrow-immutable-upvar-mutation.rs:18:24 | LL | let _g = to_fn(|| set(&mut y)); | ^^^^^^^^^^^^^^ error[E0594]: cannot assign to `z`, as it is a captured variable in a `Fn` closure --> $DIR/borrow-immutable-upvar-mutation.rs:21:55 | LL | let _h = to_fn_mut(|| { set(&mut z); to_fn(|| z = 42); }); | ^^^^^^ cannot assign | help: consider changing this to accept closures that implement `FnMut` --> $DIR/borrow-immutable-upvar-mutation.rs:21:52 | LL | let _h = to_fn_mut(|| { set(&mut z); to_fn(|| z = 42); }); | ^^^^^^^^^ error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure --> $DIR/borrow-immutable-upvar-mutation.rs:27:32 | LL | let _f = to_fn(move || x = 42); | ^^^^^^ cannot assign | help: consider changing this to accept closures that implement `FnMut` --> $DIR/borrow-immutable-upvar-mutation.rs:27:24 | LL | let _f = to_fn(move || x = 42); | ^^^^^^^^^^^^^^ error[E0596]: cannot borrow `y` as mutable, as it is a captured variable in a `Fn` closure --> $DIR/borrow-immutable-upvar-mutation.rs:30:36 | LL | let _g = to_fn(move || set(&mut y)); | ^^^^^^ cannot borrow as mutable | help: consider changing this to accept closures that implement `FnMut` --> $DIR/borrow-immutable-upvar-mutation.rs:30:24 | LL | let _g = to_fn(move || set(&mut y)); | ^^^^^^^^^^^^^^^^^^^ error[E0594]: cannot assign to `z`, as it is a captured variable in a `Fn` closure --> $DIR/borrow-immutable-upvar-mutation.rs:33:65 | LL | let _h = to_fn_mut(move || { set(&mut z); to_fn(move || z = 42); }); | ^^^^^^ cannot assign | help: consider changing this to accept closures that implement `FnMut` --> $DIR/borrow-immutable-upvar-mutation.rs:33:57 | LL | let _h = to_fn_mut(move || { set(&mut z); to_fn(move || z = 42); }); | ^^^^^^^^^^^^^^ error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0596`.