error[E0594]: cannot assign to `x`, as it is not declared as mutable --> $DIR/closure-captures.rs:7:5 | LL | fn one_closure(x: i32) { | - help: consider changing this to be mutable: `mut x` LL | || LL | x = 1; | ^^^^^ cannot assign error[E0594]: cannot assign to `x`, as it is not declared as mutable --> $DIR/closure-captures.rs:9:5 | LL | fn one_closure(x: i32) { | - help: consider changing this to be mutable: `mut x` ... LL | x = 1; | ^^^^^ cannot assign error[E0594]: cannot assign to `x`, as it is not declared as mutable --> $DIR/closure-captures.rs:15:9 | LL | fn two_closures(x: i32) { | - help: consider changing this to be mutable: `mut x` ... LL | x = 1; | ^^^^^ cannot assign error[E0594]: cannot assign to `x`, as it is not declared as mutable --> $DIR/closure-captures.rs:19:9 | LL | fn two_closures(x: i32) { | - help: consider changing this to be mutable: `mut x` ... LL | x = 1; | ^^^^^ cannot assign error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure --> $DIR/closure-captures.rs:27:9 | LL | || | ^^ cannot borrow as mutable LL | x = 1;} | - mutable borrow occurs due to use of `x` in closure | help: consider changing this to accept closures that implement `FnMut` --> $DIR/closure-captures.rs:26:12 | LL | fn_ref(|| { | ____________^ LL | | || LL | | x = 1;} | |________________^ error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure --> $DIR/closure-captures.rs:31:9 | LL | || | ^^ cannot borrow as mutable LL | x = 1;}); | - mutable borrow occurs due to use of `x` in closure | help: consider changing this to accept closures that implement `FnMut` --> $DIR/closure-captures.rs:30:12 | LL | fn_ref(move || { | ____________^ LL | | || LL | | x = 1;}); | |___________^ error[E0594]: cannot assign to `x`, as it is not declared as mutable --> $DIR/closure-captures.rs:39:10 | LL | fn two_closures_ref(x: i32) { | - help: consider changing this to be mutable: `mut x` ... LL | x = 1;} | ^^^^^ cannot assign error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure --> $DIR/closure-captures.rs:38:9 | LL | || | ^^ cannot borrow as mutable LL | x = 1;} | - mutable borrow occurs due to use of `x` in closure | help: consider changing this to accept closures that implement `FnMut` --> $DIR/closure-captures.rs:37:12 | LL | fn_ref(|| { | ____________^ LL | | || LL | | x = 1;} | |________________^ error[E0594]: cannot assign to `x`, as it is not declared as mutable --> $DIR/closure-captures.rs:43:5 | LL | fn two_closures_ref(x: i32) { | - help: consider changing this to be mutable: `mut x` ... LL | x = 1;}); | ^^^^^ cannot assign error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure --> $DIR/closure-captures.rs:42:9 | LL | || | ^^ cannot borrow as mutable LL | x = 1;}); | - mutable borrow occurs due to use of `x` in closure | help: consider changing this to accept closures that implement `FnMut` --> $DIR/closure-captures.rs:41:12 | LL | fn_ref(move || { | ____________^ LL | | || LL | | x = 1;}); | |___________^ error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure --> $DIR/closure-captures.rs:48:9 | LL | || | ^^ cannot borrow as mutable LL | *x = 1;}); | - mutable borrow occurs due to use of `x` in closure | help: consider changing this to accept closures that implement `FnMut` --> $DIR/closure-captures.rs:47:12 | LL | fn_ref(|| { | ____________^ LL | | || LL | | *x = 1;}); | |________________^ error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure --> $DIR/closure-captures.rs:51:9 | LL | || | ^^ cannot borrow as mutable LL | *x = 1;}); | - mutable borrow occurs due to use of `x` in closure | help: consider changing this to accept closures that implement `FnMut` --> $DIR/closure-captures.rs:50:12 | LL | fn_ref(move || { | ____________^ LL | | || LL | | *x = 1;}); | |________________^ error: aborting due to 12 previous errors For more information about this error, try `rustc --explain E0596`.