1 error[E0594]: cannot assign to `x`, as it is not declared as mutable
2 --> $DIR/closure-captures.rs:7:5
4 LL | fn one_closure(x: i32) {
5 | - help: consider changing this to be mutable: `mut x`
10 error[E0594]: cannot assign to `x`, as it is not declared as mutable
11 --> $DIR/closure-captures.rs:9:5
13 LL | fn one_closure(x: i32) {
14 | - help: consider changing this to be mutable: `mut x`
19 error[E0594]: cannot assign to `x`, as it is not declared as mutable
20 --> $DIR/closure-captures.rs:15:9
22 LL | fn two_closures(x: i32) {
23 | - help: consider changing this to be mutable: `mut x`
28 error[E0594]: cannot assign to `x`, as it is not declared as mutable
29 --> $DIR/closure-captures.rs:19:9
31 LL | fn two_closures(x: i32) {
32 | - help: consider changing this to be mutable: `mut x`
37 error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
38 --> $DIR/closure-captures.rs:27:9
40 LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
41 | - change this to accept `FnMut` instead of `Fn`
46 | | expects `Fn` instead of `FnMut`
48 | | ^^ cannot borrow as mutable
50 | |__________-_____- in this closure
52 | mutable borrow occurs due to use of `x` in closure
54 error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
55 --> $DIR/closure-captures.rs:31:9
57 LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
58 | - change this to accept `FnMut` instead of `Fn`
63 | | expects `Fn` instead of `FnMut`
65 | | ^^ cannot borrow as mutable
67 | |_____-_____- in this closure
69 | mutable borrow occurs due to use of `x` in closure
71 error[E0594]: cannot assign to `x`, as it is not declared as mutable
72 --> $DIR/closure-captures.rs:39:10
74 LL | fn two_closures_ref(x: i32) {
75 | - help: consider changing this to be mutable: `mut x`
80 error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
81 --> $DIR/closure-captures.rs:38:9
83 LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
84 | - change this to accept `FnMut` instead of `Fn`
89 | | expects `Fn` instead of `FnMut`
91 | | ^^ cannot borrow as mutable
93 | |__________-_____- in this closure
95 | mutable borrow occurs due to use of `x` in closure
97 error[E0594]: cannot assign to `x`, as it is not declared as mutable
98 --> $DIR/closure-captures.rs:43:5
100 LL | fn two_closures_ref(x: i32) {
101 | - help: consider changing this to be mutable: `mut x`
104 | ^^^^^ cannot assign
106 error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
107 --> $DIR/closure-captures.rs:42:9
109 LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
110 | - change this to accept `FnMut` instead of `Fn`
112 LL | fn_ref(move || {
115 | | expects `Fn` instead of `FnMut`
117 | | ^^ cannot borrow as mutable
119 | |_____-_____- in this closure
121 | mutable borrow occurs due to use of `x` in closure
123 error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
124 --> $DIR/closure-captures.rs:48:9
126 LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
127 | - change this to accept `FnMut` instead of `Fn`
132 | | expects `Fn` instead of `FnMut`
134 | | ^^ cannot borrow as mutable
136 | |__________-_____- in this closure
138 | mutable borrow occurs due to use of `x` in closure
140 error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
141 --> $DIR/closure-captures.rs:51:9
143 LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
144 | - change this to accept `FnMut` instead of `Fn`
146 LL | fn_ref(move || {
149 | | expects `Fn` instead of `FnMut`
151 | | ^^ cannot borrow as mutable
153 | |__________-_____- in this closure
155 | mutable borrow occurs due to use of `x` in closure
157 error: aborting due to 12 previous errors
159 Some errors have detailed explanations: E0594, E0596.
160 For more information about an error, try `rustc --explain E0594`.