1 error[E0594]: cannot assign to `*x`, which is behind a `&` reference
2 --> $DIR/mutability-errors.rs:9:5
4 LL | fn named_ref(x: &(i32,)) {
5 | ------- help: consider changing this to be a mutable reference: `&mut (i32,)`
7 | ^^^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written
9 error[E0594]: cannot assign to `x.0`, which is behind a `&` reference
10 --> $DIR/mutability-errors.rs:10:5
12 LL | fn named_ref(x: &(i32,)) {
13 | ------- help: consider changing this to be a mutable reference: `&mut (i32,)`
16 | ^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written
18 error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
19 --> $DIR/mutability-errors.rs:11:5
21 LL | fn named_ref(x: &(i32,)) {
22 | ------- help: consider changing this to be a mutable reference: `&mut (i32,)`
25 | ^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
27 error[E0596]: cannot borrow `x.0` as mutable, as it is behind a `&` reference
28 --> $DIR/mutability-errors.rs:12:5
30 LL | fn named_ref(x: &(i32,)) {
31 | ------- help: consider changing this to be a mutable reference: `&mut (i32,)`
34 | ^^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
36 error[E0594]: cannot assign to data in a `&` reference
37 --> $DIR/mutability-errors.rs:16:5
40 | ^^^^^^^^^^^ cannot assign
42 error[E0594]: cannot assign to data in a `&` reference
43 --> $DIR/mutability-errors.rs:17:5
46 | ^^^^^^^^^ cannot assign
48 error[E0596]: cannot borrow data in a `&` reference as mutable
49 --> $DIR/mutability-errors.rs:18:5
52 | ^^^^^^^^^ cannot borrow as mutable
54 error[E0596]: cannot borrow data in a `&` reference as mutable
55 --> $DIR/mutability-errors.rs:19:5
58 | ^^^^^^^^^^ cannot borrow as mutable
60 error[E0594]: cannot assign to `*x`, which is behind a `*const` pointer
61 --> $DIR/mutability-errors.rs:23:5
63 LL | unsafe fn named_ptr(x: *const (i32,)) {
64 | ------------- help: consider changing this to be a mutable pointer: `*mut (i32,)`
66 | ^^^^^^^^^ `x` is a `*const` pointer, so the data it refers to cannot be written
68 error[E0594]: cannot assign to `x.0`, which is behind a `*const` pointer
69 --> $DIR/mutability-errors.rs:24:5
71 LL | unsafe fn named_ptr(x: *const (i32,)) {
72 | ------------- help: consider changing this to be a mutable pointer: `*mut (i32,)`
75 | ^^^^^^^^^^ `x` is a `*const` pointer, so the data it refers to cannot be written
77 error[E0596]: cannot borrow `*x` as mutable, as it is behind a `*const` pointer
78 --> $DIR/mutability-errors.rs:25:5
80 LL | unsafe fn named_ptr(x: *const (i32,)) {
81 | ------------- help: consider changing this to be a mutable pointer: `*mut (i32,)`
84 | ^^^^^^^ `x` is a `*const` pointer, so the data it refers to cannot be borrowed as mutable
86 error[E0596]: cannot borrow `x.0` as mutable, as it is behind a `*const` pointer
87 --> $DIR/mutability-errors.rs:26:5
89 LL | unsafe fn named_ptr(x: *const (i32,)) {
90 | ------------- help: consider changing this to be a mutable pointer: `*mut (i32,)`
93 | ^^^^^^^^^^^ `x` is a `*const` pointer, so the data it refers to cannot be borrowed as mutable
95 error[E0594]: cannot assign to data in a `*const` pointer
96 --> $DIR/mutability-errors.rs:30:5
99 | ^^^^^^^^^^^ cannot assign
101 error[E0594]: cannot assign to data in a `*const` pointer
102 --> $DIR/mutability-errors.rs:31:5
105 | ^^^^^^^^^^^^ cannot assign
107 error[E0596]: cannot borrow data in a `*const` pointer as mutable
108 --> $DIR/mutability-errors.rs:32:5
111 | ^^^^^^^^^ cannot borrow as mutable
113 error[E0596]: cannot borrow data in a `*const` pointer as mutable
114 --> $DIR/mutability-errors.rs:33:5
117 | ^^^^^^^^^^^^^ cannot borrow as mutable
119 error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure
120 --> $DIR/mutability-errors.rs:40:9
122 LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
123 | - change this to accept `FnMut` instead of `Fn`
128 | | expects `Fn` instead of `FnMut`
130 | | ^^^^^^^^ cannot assign
135 | |_____- in this closure
137 error[E0594]: cannot assign to `x.0`, as `Fn` closures cannot mutate their captured variables
138 --> $DIR/mutability-errors.rs:41:9
140 LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
141 | - change this to accept `FnMut` instead of `Fn`
146 | | expects `Fn` instead of `FnMut`
149 | | ^^^^^^^ cannot assign
153 | |_____- in this closure
155 error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
156 --> $DIR/mutability-errors.rs:42:9
158 LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
159 | - change this to accept `FnMut` instead of `Fn`
164 | | expects `Fn` instead of `FnMut`
168 | | ^^^^^^ cannot borrow as mutable
171 | |_____- in this closure
173 error[E0596]: cannot borrow `x.0` as mutable, as `Fn` closures cannot mutate their captured variables
174 --> $DIR/mutability-errors.rs:43:9
176 LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
177 | - change this to accept `FnMut` instead of `Fn`
182 | | expects `Fn` instead of `FnMut`
187 | | ^^^^^^^^ cannot borrow as mutable
189 | |_____- in this closure
191 error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure
192 --> $DIR/mutability-errors.rs:46:9
194 LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
195 | - change this to accept `FnMut` instead of `Fn`
197 LL | fn_ref(move || {
200 | | expects `Fn` instead of `FnMut`
202 | | ^^^^^^^^ cannot assign
207 | |_____- in this closure
209 error[E0594]: cannot assign to `x.0`, as `Fn` closures cannot mutate their captured variables
210 --> $DIR/mutability-errors.rs:47:9
212 LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
213 | - change this to accept `FnMut` instead of `Fn`
215 LL | fn_ref(move || {
218 | | expects `Fn` instead of `FnMut`
221 | | ^^^^^^^ cannot assign
225 | |_____- in this closure
227 error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
228 --> $DIR/mutability-errors.rs:48:9
230 LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
231 | - change this to accept `FnMut` instead of `Fn`
233 LL | fn_ref(move || {
236 | | expects `Fn` instead of `FnMut`
240 | | ^^^^^^ cannot borrow as mutable
243 | |_____- in this closure
245 error[E0596]: cannot borrow `x.0` as mutable, as `Fn` closures cannot mutate their captured variables
246 --> $DIR/mutability-errors.rs:49:9
248 LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
249 | - change this to accept `FnMut` instead of `Fn`
251 LL | fn_ref(move || {
254 | | expects `Fn` instead of `FnMut`
259 | | ^^^^^^^^ cannot borrow as mutable
261 | |_____- in this closure
263 error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
264 --> $DIR/mutability-errors.rs:54:5
266 LL | fn imm_local(x: (i32,)) {
267 | - help: consider changing this to be mutable: `mut x`
269 | ^^^^^^ cannot borrow as mutable
271 error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable
272 --> $DIR/mutability-errors.rs:55:5
274 LL | fn imm_local(x: (i32,)) {
275 | - help: consider changing this to be mutable: `mut x`
278 | ^^^^^^^^ cannot borrow as mutable
280 error[E0594]: cannot assign to `x`, as it is not declared as mutable
281 --> $DIR/mutability-errors.rs:60:9
283 LL | fn imm_capture(x: (i32,)) {
284 | - help: consider changing this to be mutable: `mut x`
287 | ^^^^^^^^ cannot assign
289 error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable
290 --> $DIR/mutability-errors.rs:61:9
292 LL | fn imm_capture(x: (i32,)) {
293 | - help: consider changing this to be mutable: `mut x`
296 | ^^^^^^^ cannot assign
298 error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
299 --> $DIR/mutability-errors.rs:62:9
301 LL | fn imm_capture(x: (i32,)) {
302 | - help: consider changing this to be mutable: `mut x`
305 | ^^^^^^ cannot borrow as mutable
307 error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable
308 --> $DIR/mutability-errors.rs:63:9
310 LL | fn imm_capture(x: (i32,)) {
311 | - help: consider changing this to be mutable: `mut x`
314 | ^^^^^^^^ cannot borrow as mutable
316 error[E0594]: cannot assign to `x`, as it is not declared as mutable
317 --> $DIR/mutability-errors.rs:66:9
319 LL | fn imm_capture(x: (i32,)) {
320 | - help: consider changing this to be mutable: `mut x`
323 | ^^^^^^^^ cannot assign
325 error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable
326 --> $DIR/mutability-errors.rs:67:9
328 LL | fn imm_capture(x: (i32,)) {
329 | - help: consider changing this to be mutable: `mut x`
332 | ^^^^^^^ cannot assign
334 error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
335 --> $DIR/mutability-errors.rs:68:9
337 LL | fn imm_capture(x: (i32,)) {
338 | - help: consider changing this to be mutable: `mut x`
341 | ^^^^^^ cannot borrow as mutable
343 error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable
344 --> $DIR/mutability-errors.rs:69:9
346 LL | fn imm_capture(x: (i32,)) {
347 | - help: consider changing this to be mutable: `mut x`
350 | ^^^^^^^^ cannot borrow as mutable
352 error[E0594]: cannot assign to immutable static item `X`
353 --> $DIR/mutability-errors.rs:76:5
356 | ^^^^^^^^ cannot assign
358 error[E0594]: cannot assign to `X.0`, as `X` is an immutable static item
359 --> $DIR/mutability-errors.rs:77:5
362 | ^^^^^^^ cannot assign
364 error[E0596]: cannot borrow immutable static item `X` as mutable
365 --> $DIR/mutability-errors.rs:78:5
368 | ^^^^^^ cannot borrow as mutable
370 error[E0596]: cannot borrow `X.0` as mutable, as `X` is an immutable static item
371 --> $DIR/mutability-errors.rs:79:5
374 | ^^^^^^^^ cannot borrow as mutable
376 error: aborting due to 38 previous errors
378 Some errors have detailed explanations: E0594, E0596.
379 For more information about an error, try `rustc --explain E0594`.