]>
Commit | Line | Data |
---|---|---|
8faf50e0 | 1 | error[E0594]: cannot assign to `x`, as it is not declared as mutable |
48663c56 | 2 | --> $DIR/closure-captures.rs:7:5 |
8faf50e0 XL |
3 | | |
4 | LL | fn one_closure(x: i32) { | |
5 | | - help: consider changing this to be mutable: `mut x` | |
6 | LL | || | |
532ac7d7 | 7 | LL | x = 1; |
8faf50e0 XL |
8 | | ^^^^^ cannot assign |
9 | ||
10 | error[E0594]: cannot assign to `x`, as it is not declared as mutable | |
48663c56 | 11 | --> $DIR/closure-captures.rs:9:5 |
8faf50e0 XL |
12 | | |
13 | LL | fn one_closure(x: i32) { | |
14 | | - help: consider changing this to be mutable: `mut x` | |
15 | ... | |
532ac7d7 | 16 | LL | x = 1; |
8faf50e0 XL |
17 | | ^^^^^ cannot assign |
18 | ||
19 | error[E0594]: cannot assign to `x`, as it is not declared as mutable | |
48663c56 | 20 | --> $DIR/closure-captures.rs:15:9 |
8faf50e0 XL |
21 | | |
22 | LL | fn two_closures(x: i32) { | |
23 | | - help: consider changing this to be mutable: `mut x` | |
24 | ... | |
532ac7d7 | 25 | LL | x = 1; |
8faf50e0 XL |
26 | | ^^^^^ cannot assign |
27 | ||
28 | error[E0594]: cannot assign to `x`, as it is not declared as mutable | |
48663c56 | 29 | --> $DIR/closure-captures.rs:19:9 |
8faf50e0 XL |
30 | | |
31 | LL | fn two_closures(x: i32) { | |
32 | | - help: consider changing this to be mutable: `mut x` | |
33 | ... | |
532ac7d7 | 34 | LL | x = 1; |
8faf50e0 XL |
35 | | ^^^^^ cannot assign |
36 | ||
37 | error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure | |
48663c56 | 38 | --> $DIR/closure-captures.rs:27:9 |
8faf50e0 | 39 | | |
74b04a01 XL |
40 | LL | fn fn_ref<F: Fn()>(f: F) -> F { f } |
41 | | - change this to accept `FnMut` instead of `Fn` | |
42 | ... | |
8faf50e0 | 43 | LL | fn_ref(|| { |
74b04a01 XL |
44 | | _____------_- |
45 | | | | | |
46 | | | expects `Fn` instead of `FnMut` | |
532ac7d7 | 47 | LL | | || |
74b04a01 | 48 | | | ^^ cannot borrow as mutable |
8faf50e0 | 49 | LL | | x = 1;} |
74b04a01 XL |
50 | | |__________-_____- in this closure |
51 | | | | |
52 | | mutable borrow occurs due to use of `x` in closure | |
8faf50e0 XL |
53 | |
54 | error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure | |
48663c56 | 55 | --> $DIR/closure-captures.rs:31:9 |
8faf50e0 | 56 | | |
74b04a01 XL |
57 | LL | fn fn_ref<F: Fn()>(f: F) -> F { f } |
58 | | - change this to accept `FnMut` instead of `Fn` | |
59 | ... | |
8faf50e0 | 60 | LL | fn_ref(move || { |
74b04a01 XL |
61 | | _____------_- |
62 | | | | | |
63 | | | expects `Fn` instead of `FnMut` | |
532ac7d7 | 64 | LL | | || |
74b04a01 | 65 | | | ^^ cannot borrow as mutable |
8faf50e0 | 66 | LL | | x = 1;}); |
74b04a01 XL |
67 | | |_____-_____- in this closure |
68 | | | | |
69 | | mutable borrow occurs due to use of `x` in closure | |
8faf50e0 XL |
70 | |
71 | error[E0594]: cannot assign to `x`, as it is not declared as mutable | |
48663c56 | 72 | --> $DIR/closure-captures.rs:39:10 |
8faf50e0 XL |
73 | | |
74 | LL | fn two_closures_ref(x: i32) { | |
75 | | - help: consider changing this to be mutable: `mut x` | |
76 | ... | |
532ac7d7 | 77 | LL | x = 1;} |
8faf50e0 XL |
78 | | ^^^^^ cannot assign |
79 | ||
80 | error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure | |
48663c56 | 81 | --> $DIR/closure-captures.rs:38:9 |
8faf50e0 | 82 | | |
74b04a01 XL |
83 | LL | fn fn_ref<F: Fn()>(f: F) -> F { f } |
84 | | - change this to accept `FnMut` instead of `Fn` | |
85 | ... | |
8faf50e0 | 86 | LL | fn_ref(|| { |
74b04a01 XL |
87 | | _____------_- |
88 | | | | | |
89 | | | expects `Fn` instead of `FnMut` | |
532ac7d7 | 90 | LL | | || |
74b04a01 | 91 | | | ^^ cannot borrow as mutable |
532ac7d7 | 92 | LL | | x = 1;} |
74b04a01 XL |
93 | | |__________-_____- in this closure |
94 | | | | |
95 | | mutable borrow occurs due to use of `x` in closure | |
8faf50e0 XL |
96 | |
97 | error[E0594]: cannot assign to `x`, as it is not declared as mutable | |
48663c56 | 98 | --> $DIR/closure-captures.rs:43:5 |
8faf50e0 XL |
99 | | |
100 | LL | fn two_closures_ref(x: i32) { | |
101 | | - help: consider changing this to be mutable: `mut x` | |
102 | ... | |
532ac7d7 | 103 | LL | x = 1;}); |
8faf50e0 XL |
104 | | ^^^^^ cannot assign |
105 | ||
106 | error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure | |
48663c56 | 107 | --> $DIR/closure-captures.rs:42:9 |
8faf50e0 | 108 | | |
74b04a01 XL |
109 | LL | fn fn_ref<F: Fn()>(f: F) -> F { f } |
110 | | - change this to accept `FnMut` instead of `Fn` | |
111 | ... | |
8faf50e0 | 112 | LL | fn_ref(move || { |
74b04a01 XL |
113 | | _____------_- |
114 | | | | | |
115 | | | expects `Fn` instead of `FnMut` | |
532ac7d7 | 116 | LL | | || |
74b04a01 | 117 | | | ^^ cannot borrow as mutable |
532ac7d7 | 118 | LL | | x = 1;}); |
74b04a01 XL |
119 | | |_____-_____- in this closure |
120 | | | | |
121 | | mutable borrow occurs due to use of `x` in closure | |
8faf50e0 XL |
122 | |
123 | error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure | |
48663c56 | 124 | --> $DIR/closure-captures.rs:48:9 |
8faf50e0 | 125 | | |
74b04a01 XL |
126 | LL | fn fn_ref<F: Fn()>(f: F) -> F { f } |
127 | | - change this to accept `FnMut` instead of `Fn` | |
128 | ... | |
8faf50e0 | 129 | LL | fn_ref(|| { |
74b04a01 XL |
130 | | _____------_- |
131 | | | | | |
132 | | | expects `Fn` instead of `FnMut` | |
532ac7d7 | 133 | LL | | || |
74b04a01 | 134 | | | ^^ cannot borrow as mutable |
8faf50e0 | 135 | LL | | *x = 1;}); |
17df50a5 XL |
136 | | |_________--_____- in this closure |
137 | | | | |
138 | | mutable borrow occurs due to use of `x` in closure | |
8faf50e0 XL |
139 | |
140 | error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure | |
48663c56 | 141 | --> $DIR/closure-captures.rs:51:9 |
8faf50e0 | 142 | | |
74b04a01 XL |
143 | LL | fn fn_ref<F: Fn()>(f: F) -> F { f } |
144 | | - change this to accept `FnMut` instead of `Fn` | |
145 | ... | |
8faf50e0 | 146 | LL | fn_ref(move || { |
74b04a01 XL |
147 | | _____------_- |
148 | | | | | |
149 | | | expects `Fn` instead of `FnMut` | |
532ac7d7 | 150 | LL | | || |
74b04a01 | 151 | | | ^^ cannot borrow as mutable |
8faf50e0 | 152 | LL | | *x = 1;}); |
17df50a5 XL |
153 | | |_________--_____- in this closure |
154 | | | | |
155 | | mutable borrow occurs due to use of `x` in closure | |
8faf50e0 XL |
156 | |
157 | error: aborting due to 12 previous errors | |
158 | ||
60c5eb7d XL |
159 | Some errors have detailed explanations: E0594, E0596. |
160 | For more information about an error, try `rustc --explain E0594`. |