1 error[E0594]: cannot assign to `*x`, which is behind a `&` reference
2 --> $DIR/mutability-errors.rs:9:5
5 | ^^^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written
7 help: consider changing this to be a mutable reference
9 LL | fn named_ref(x: &mut (i32,)) {
12 error[E0594]: cannot assign to `x.0`, which is behind a `&` reference
13 --> $DIR/mutability-errors.rs:10:5
16 | ^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written
18 help: consider changing this to be a mutable reference
20 LL | fn named_ref(x: &mut (i32,)) {
23 error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
24 --> $DIR/mutability-errors.rs:11:5
27 | ^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
29 help: consider changing this to be a mutable reference
31 LL | fn named_ref(x: &mut (i32,)) {
34 error[E0596]: cannot borrow `x.0` as mutable, as it is behind a `&` reference
35 --> $DIR/mutability-errors.rs:12:5
38 | ^^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
40 help: consider changing this to be a mutable reference
42 LL | fn named_ref(x: &mut (i32,)) {
45 error[E0594]: cannot assign to data in a `&` reference
46 --> $DIR/mutability-errors.rs:16:5
49 | ^^^^^^^^^^^ cannot assign
51 error[E0594]: cannot assign to data in a `&` reference
52 --> $DIR/mutability-errors.rs:17:5
55 | ^^^^^^^^^ cannot assign
57 error[E0596]: cannot borrow data in a `&` reference as mutable
58 --> $DIR/mutability-errors.rs:18:5
61 | ^^^^^^^^^ cannot borrow as mutable
63 error[E0596]: cannot borrow data in a `&` reference as mutable
64 --> $DIR/mutability-errors.rs:19:5
67 | ^^^^^^^^^^ cannot borrow as mutable
69 error[E0594]: cannot assign to `*x`, which is behind a `*const` pointer
70 --> $DIR/mutability-errors.rs:23:5
73 | ^^^^^^^^^ `x` is a `*const` pointer, so the data it refers to cannot be written
75 help: consider changing this to be a mutable pointer
77 LL | unsafe fn named_ptr(x: *mut (i32,)) {
80 error[E0594]: cannot assign to `x.0`, which is behind a `*const` pointer
81 --> $DIR/mutability-errors.rs:24:5
84 | ^^^^^^^^^^ `x` is a `*const` pointer, so the data it refers to cannot be written
86 help: consider changing this to be a mutable pointer
88 LL | unsafe fn named_ptr(x: *mut (i32,)) {
91 error[E0596]: cannot borrow `*x` as mutable, as it is behind a `*const` pointer
92 --> $DIR/mutability-errors.rs:25:5
95 | ^^^^^^^ `x` is a `*const` pointer, so the data it refers to cannot be borrowed as mutable
97 help: consider changing this to be a mutable pointer
99 LL | unsafe fn named_ptr(x: *mut (i32,)) {
102 error[E0596]: cannot borrow `x.0` as mutable, as it is behind a `*const` pointer
103 --> $DIR/mutability-errors.rs:26:5
106 | ^^^^^^^^^^^ `x` is a `*const` pointer, so the data it refers to cannot be borrowed as mutable
108 help: consider changing this to be a mutable pointer
110 LL | unsafe fn named_ptr(x: *mut (i32,)) {
113 error[E0594]: cannot assign to data in a `*const` pointer
114 --> $DIR/mutability-errors.rs:30:5
117 | ^^^^^^^^^^^ cannot assign
119 error[E0594]: cannot assign to data in a `*const` pointer
120 --> $DIR/mutability-errors.rs:31:5
123 | ^^^^^^^^^^^^ cannot assign
125 error[E0596]: cannot borrow data in a `*const` pointer as mutable
126 --> $DIR/mutability-errors.rs:32:5
129 | ^^^^^^^^^ cannot borrow as mutable
131 error[E0596]: cannot borrow data in a `*const` pointer as mutable
132 --> $DIR/mutability-errors.rs:33:5
135 | ^^^^^^^^^^^^^ cannot borrow as mutable
137 error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure
138 --> $DIR/mutability-errors.rs:40:9
140 LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
141 | - change this to accept `FnMut` instead of `Fn`
144 | ------ -- in this closure
146 | expects `Fn` instead of `FnMut`
148 | ^^^^^^^^ cannot assign
150 error[E0594]: cannot assign to `x.0`, as `Fn` closures cannot mutate their captured variables
151 --> $DIR/mutability-errors.rs:41:9
153 LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
154 | - change this to accept `FnMut` instead of `Fn`
157 | ------ -- in this closure
159 | expects `Fn` instead of `FnMut`
162 | ^^^^^^^ cannot assign
164 error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
165 --> $DIR/mutability-errors.rs:42:9
167 LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
168 | - change this to accept `FnMut` instead of `Fn`
171 | ------ -- in this closure
173 | expects `Fn` instead of `FnMut`
176 | ^^^^^^ cannot borrow as mutable
178 error[E0596]: cannot borrow `x.0` as mutable, as `Fn` closures cannot mutate their captured variables
179 --> $DIR/mutability-errors.rs:43:9
181 LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
182 | - change this to accept `FnMut` instead of `Fn`
185 | ------ -- in this closure
187 | expects `Fn` instead of `FnMut`
190 | ^^^^^^^^ cannot borrow as mutable
192 error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure
193 --> $DIR/mutability-errors.rs:46:9
195 LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
196 | - change this to accept `FnMut` instead of `Fn`
198 LL | fn_ref(move || {
199 | ------ ------- in this closure
201 | expects `Fn` instead of `FnMut`
203 | ^^^^^^^^ cannot assign
205 error[E0594]: cannot assign to `x.0`, as `Fn` closures cannot mutate their captured variables
206 --> $DIR/mutability-errors.rs:47:9
208 LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
209 | - change this to accept `FnMut` instead of `Fn`
211 LL | fn_ref(move || {
212 | ------ ------- in this closure
214 | expects `Fn` instead of `FnMut`
217 | ^^^^^^^ cannot assign
219 error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
220 --> $DIR/mutability-errors.rs:48:9
222 LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
223 | - change this to accept `FnMut` instead of `Fn`
225 LL | fn_ref(move || {
226 | ------ ------- in this closure
228 | expects `Fn` instead of `FnMut`
231 | ^^^^^^ cannot borrow as mutable
233 error[E0596]: cannot borrow `x.0` as mutable, as `Fn` closures cannot mutate their captured variables
234 --> $DIR/mutability-errors.rs:49:9
236 LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
237 | - change this to accept `FnMut` instead of `Fn`
239 LL | fn_ref(move || {
240 | ------ ------- in this closure
242 | expects `Fn` instead of `FnMut`
245 | ^^^^^^^^ cannot borrow as mutable
247 error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
248 --> $DIR/mutability-errors.rs:53:14
250 LL | fn imm_local(x: (i32,)) {
253 | ------ cannot borrow as mutable
255 | -------- cannot borrow as mutable
257 help: consider changing this to be mutable
259 LL | fn imm_local(mut x: (i32,)) {
262 error[E0594]: cannot assign to `x`, as it is not declared as mutable
263 --> $DIR/mutability-errors.rs:60:9
265 LL | fn imm_capture(x: (i32,)) {
266 | - help: consider changing this to be mutable: `mut x`
269 | ^^^^^^^^ cannot assign
271 error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable
272 --> $DIR/mutability-errors.rs:61:9
274 LL | fn imm_capture(x: (i32,)) {
275 | - help: consider changing this to be mutable: `mut x`
278 | ^^^^^^^ cannot assign
280 error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
281 --> $DIR/mutability-errors.rs:62:9
283 LL | fn imm_capture(x: (i32,)) {
284 | - help: consider changing this to be mutable: `mut x`
287 | ^^^^^^ cannot borrow as mutable
289 error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable
290 --> $DIR/mutability-errors.rs:63:9
292 LL | fn imm_capture(x: (i32,)) {
293 | - help: consider changing this to be mutable: `mut x`
296 | ^^^^^^^^ cannot borrow as mutable
298 error[E0594]: cannot assign to `x`, as it is not declared as mutable
299 --> $DIR/mutability-errors.rs:66:9
301 LL | fn imm_capture(x: (i32,)) {
302 | - help: consider changing this to be mutable: `mut x`
305 | ^^^^^^^^ cannot assign
307 error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable
308 --> $DIR/mutability-errors.rs:67:9
310 LL | fn imm_capture(x: (i32,)) {
311 | - help: consider changing this to be mutable: `mut x`
314 | ^^^^^^^ cannot assign
316 error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
317 --> $DIR/mutability-errors.rs:68:9
319 LL | fn imm_capture(x: (i32,)) {
320 | - help: consider changing this to be mutable: `mut x`
323 | ^^^^^^ cannot borrow as mutable
325 error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable
326 --> $DIR/mutability-errors.rs:69:9
328 LL | fn imm_capture(x: (i32,)) {
329 | - help: consider changing this to be mutable: `mut x`
332 | ^^^^^^^^ cannot borrow as mutable
334 error[E0594]: cannot assign to immutable static item `X`
335 --> $DIR/mutability-errors.rs:76:5
338 | ^^^^^^^^ cannot assign
340 error[E0594]: cannot assign to `X.0`, as `X` is an immutable static item
341 --> $DIR/mutability-errors.rs:77:5
344 | ^^^^^^^ cannot assign
346 error[E0596]: cannot borrow immutable static item `X` as mutable
347 --> $DIR/mutability-errors.rs:78:5
350 | ^^^^^^ cannot borrow as mutable
352 error[E0596]: cannot borrow `X.0` as mutable, as `X` is an immutable static item
353 --> $DIR/mutability-errors.rs:79:5
356 | ^^^^^^^^ cannot borrow as mutable
358 error: aborting due to 37 previous errors
360 Some errors have detailed explanations: E0594, E0596.
361 For more information about an error, try `rustc --explain E0594`.