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`
126 | ------ -- in this closure
128 | expects `Fn` instead of `FnMut`
130 | ^^^^^^^^ cannot assign
132 error[E0594]: cannot assign to `x.0`, as `Fn` closures cannot mutate their captured variables
133 --> $DIR/mutability-errors.rs:41:9
135 LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
136 | - change this to accept `FnMut` instead of `Fn`
139 | ------ -- in this closure
141 | expects `Fn` instead of `FnMut`
144 | ^^^^^^^ cannot assign
146 error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
147 --> $DIR/mutability-errors.rs:42:9
149 LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
150 | - change this to accept `FnMut` instead of `Fn`
153 | ------ -- in this closure
155 | expects `Fn` instead of `FnMut`
158 | ^^^^^^ cannot borrow as mutable
160 error[E0596]: cannot borrow `x.0` as mutable, as `Fn` closures cannot mutate their captured variables
161 --> $DIR/mutability-errors.rs:43:9
163 LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
164 | - change this to accept `FnMut` instead of `Fn`
167 | ------ -- in this closure
169 | expects `Fn` instead of `FnMut`
172 | ^^^^^^^^ cannot borrow as mutable
174 error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure
175 --> $DIR/mutability-errors.rs:46:9
177 LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
178 | - change this to accept `FnMut` instead of `Fn`
180 LL | fn_ref(move || {
181 | ------ ------- in this closure
183 | expects `Fn` instead of `FnMut`
185 | ^^^^^^^^ cannot assign
187 error[E0594]: cannot assign to `x.0`, as `Fn` closures cannot mutate their captured variables
188 --> $DIR/mutability-errors.rs:47:9
190 LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
191 | - change this to accept `FnMut` instead of `Fn`
193 LL | fn_ref(move || {
194 | ------ ------- in this closure
196 | expects `Fn` instead of `FnMut`
199 | ^^^^^^^ cannot assign
201 error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
202 --> $DIR/mutability-errors.rs:48:9
204 LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
205 | - change this to accept `FnMut` instead of `Fn`
207 LL | fn_ref(move || {
208 | ------ ------- in this closure
210 | expects `Fn` instead of `FnMut`
213 | ^^^^^^ cannot borrow as mutable
215 error[E0596]: cannot borrow `x.0` as mutable, as `Fn` closures cannot mutate their captured variables
216 --> $DIR/mutability-errors.rs:49:9
218 LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
219 | - change this to accept `FnMut` instead of `Fn`
221 LL | fn_ref(move || {
222 | ------ ------- in this closure
224 | expects `Fn` instead of `FnMut`
227 | ^^^^^^^^ cannot borrow as mutable
229 error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
230 --> $DIR/mutability-errors.rs:54:5
232 LL | fn imm_local(x: (i32,)) {
233 | - help: consider changing this to be mutable: `mut x`
235 | ^^^^^^ cannot borrow as mutable
237 error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable
238 --> $DIR/mutability-errors.rs:55:5
240 LL | fn imm_local(x: (i32,)) {
241 | - help: consider changing this to be mutable: `mut x`
244 | ^^^^^^^^ cannot borrow as mutable
246 error[E0594]: cannot assign to `x`, as it is not declared as mutable
247 --> $DIR/mutability-errors.rs:60:9
249 LL | fn imm_capture(x: (i32,)) {
250 | - help: consider changing this to be mutable: `mut x`
253 | ^^^^^^^^ cannot assign
255 error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable
256 --> $DIR/mutability-errors.rs:61:9
258 LL | fn imm_capture(x: (i32,)) {
259 | - help: consider changing this to be mutable: `mut x`
262 | ^^^^^^^ cannot assign
264 error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
265 --> $DIR/mutability-errors.rs:62:9
267 LL | fn imm_capture(x: (i32,)) {
268 | - help: consider changing this to be mutable: `mut x`
271 | ^^^^^^ cannot borrow as mutable
273 error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable
274 --> $DIR/mutability-errors.rs:63:9
276 LL | fn imm_capture(x: (i32,)) {
277 | - help: consider changing this to be mutable: `mut x`
280 | ^^^^^^^^ cannot borrow as mutable
282 error[E0594]: cannot assign to `x`, as it is not declared as mutable
283 --> $DIR/mutability-errors.rs:66:9
285 LL | fn imm_capture(x: (i32,)) {
286 | - help: consider changing this to be mutable: `mut x`
289 | ^^^^^^^^ cannot assign
291 error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable
292 --> $DIR/mutability-errors.rs:67:9
294 LL | fn imm_capture(x: (i32,)) {
295 | - help: consider changing this to be mutable: `mut x`
298 | ^^^^^^^ cannot assign
300 error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
301 --> $DIR/mutability-errors.rs:68:9
303 LL | fn imm_capture(x: (i32,)) {
304 | - help: consider changing this to be mutable: `mut x`
307 | ^^^^^^ cannot borrow as mutable
309 error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable
310 --> $DIR/mutability-errors.rs:69:9
312 LL | fn imm_capture(x: (i32,)) {
313 | - help: consider changing this to be mutable: `mut x`
316 | ^^^^^^^^ cannot borrow as mutable
318 error[E0594]: cannot assign to immutable static item `X`
319 --> $DIR/mutability-errors.rs:76:5
322 | ^^^^^^^^ cannot assign
324 error[E0594]: cannot assign to `X.0`, as `X` is an immutable static item
325 --> $DIR/mutability-errors.rs:77:5
328 | ^^^^^^^ cannot assign
330 error[E0596]: cannot borrow immutable static item `X` as mutable
331 --> $DIR/mutability-errors.rs:78:5
334 | ^^^^^^ cannot borrow as mutable
336 error[E0596]: cannot borrow `X.0` as mutable, as `X` is an immutable static item
337 --> $DIR/mutability-errors.rs:79:5
340 | ^^^^^^^^ cannot borrow as mutable
342 error: aborting due to 38 previous errors
344 Some errors have detailed explanations: E0594, E0596.
345 For more information about an error, try `rustc --explain E0594`.