1 error[E0594]: cannot assign to immutable borrowed content `*x`
2 --> $DIR/mutability-errors.rs:19:5
4 LL | fn named_ref(x: &(i32,)) {
5 | ------- use `&mut (i32,)` here to make mutable
6 LL | *x = (1,); //~ ERROR
7 | ^^^^^^^^^ cannot borrow as mutable
9 error[E0594]: cannot assign to field `x.0` of immutable binding
10 --> $DIR/mutability-errors.rs:20:5
12 LL | fn named_ref(x: &(i32,)) {
13 | ------- use `&mut (i32,)` here to make mutable
14 LL | *x = (1,); //~ ERROR
15 LL | x.0 = 1; //~ ERROR
16 | ^^^^^^^ cannot mutably borrow field of immutable binding
18 error[E0596]: cannot borrow immutable borrowed content `*x` as mutable
19 --> $DIR/mutability-errors.rs:21:10
21 LL | fn named_ref(x: &(i32,)) {
22 | ------- use `&mut (i32,)` here to make mutable
24 LL | &mut *x; //~ ERROR
25 | ^^ cannot borrow as mutable
27 error[E0596]: cannot borrow field `x.0` of immutable binding as mutable
28 --> $DIR/mutability-errors.rs:22:10
30 LL | fn named_ref(x: &(i32,)) {
31 | ------- use `&mut (i32,)` here to make mutable
33 LL | &mut x.0; //~ ERROR
34 | ^^^ cannot mutably borrow field of immutable binding
36 error[E0594]: cannot assign to immutable borrowed content
37 --> $DIR/mutability-errors.rs:26:5
39 LL | *f() = (1,); //~ ERROR
40 | ^^^^^^^^^^^ cannot borrow as mutable
42 error[E0594]: cannot assign to field of immutable binding
43 --> $DIR/mutability-errors.rs:27:5
45 LL | f().0 = 1; //~ ERROR
46 | ^^^^^^^^^ cannot mutably borrow field of immutable binding
48 error[E0596]: cannot borrow immutable borrowed content as mutable
49 --> $DIR/mutability-errors.rs:28:10
51 LL | &mut *f(); //~ ERROR
52 | ^^^^ cannot borrow as mutable
54 error[E0596]: cannot borrow field of immutable binding as mutable
55 --> $DIR/mutability-errors.rs:29:10
57 LL | &mut f().0; //~ ERROR
58 | ^^^^^ cannot mutably borrow field of immutable binding
60 error[E0594]: cannot assign to immutable dereference of raw pointer `*x`
61 --> $DIR/mutability-errors.rs:33:5
63 LL | *x = (1,); //~ ERROR
64 | ^^^^^^^^^ cannot borrow as mutable
66 error[E0594]: cannot assign to field `x.0` of immutable binding
67 --> $DIR/mutability-errors.rs:34:5
69 LL | (*x).0 = 1; //~ ERROR
70 | ^^^^^^^^^^ cannot mutably borrow field of immutable binding
72 error[E0596]: cannot borrow immutable dereference of raw pointer `*x` as mutable
73 --> $DIR/mutability-errors.rs:35:10
75 LL | &mut *x; //~ ERROR
76 | ^^ cannot borrow as mutable
78 error[E0596]: cannot borrow field `x.0` of immutable binding as mutable
79 --> $DIR/mutability-errors.rs:36:10
81 LL | &mut (*x).0; //~ ERROR
82 | ^^^^^^ cannot mutably borrow field of immutable binding
84 error[E0594]: cannot assign to immutable dereference of raw pointer
85 --> $DIR/mutability-errors.rs:40:5
87 LL | *f() = (1,); //~ ERROR
88 | ^^^^^^^^^^^ cannot borrow as mutable
90 error[E0594]: cannot assign to field of immutable binding
91 --> $DIR/mutability-errors.rs:41:5
93 LL | (*f()).0 = 1; //~ ERROR
94 | ^^^^^^^^^^^^ cannot mutably borrow field of immutable binding
96 error[E0596]: cannot borrow immutable dereference of raw pointer as mutable
97 --> $DIR/mutability-errors.rs:42:10
99 LL | &mut *f(); //~ ERROR
100 | ^^^^ cannot borrow as mutable
102 error[E0596]: cannot borrow field of immutable binding as mutable
103 --> $DIR/mutability-errors.rs:43:10
105 LL | &mut (*f()).0; //~ ERROR
106 | ^^^^^^^^ cannot mutably borrow field of immutable binding
108 error[E0387]: cannot assign to data in a captured outer variable in an `Fn` closure
109 --> $DIR/mutability-errors.rs:50:9
111 LL | x = (1,); //~ ERROR
114 help: consider changing this closure to take self by mutable reference
115 --> $DIR/mutability-errors.rs:49:12
119 LL | | x = (1,); //~ ERROR
120 LL | | x.0 = 1; //~ ERROR
121 LL | | &mut x; //~ ERROR
122 LL | | &mut x.0; //~ ERROR
126 error[E0387]: cannot assign to data in a captured outer variable in an `Fn` closure
127 --> $DIR/mutability-errors.rs:51:9
129 LL | x.0 = 1; //~ ERROR
132 help: consider changing this closure to take self by mutable reference
133 --> $DIR/mutability-errors.rs:49:12
137 LL | | x = (1,); //~ ERROR
138 LL | | x.0 = 1; //~ ERROR
139 LL | | &mut x; //~ ERROR
140 LL | | &mut x.0; //~ ERROR
144 error[E0387]: cannot borrow data mutably in a captured outer variable in an `Fn` closure
145 --> $DIR/mutability-errors.rs:52:14
147 LL | &mut x; //~ ERROR
150 help: consider changing this closure to take self by mutable reference
151 --> $DIR/mutability-errors.rs:49:12
155 LL | | x = (1,); //~ ERROR
156 LL | | x.0 = 1; //~ ERROR
157 LL | | &mut x; //~ ERROR
158 LL | | &mut x.0; //~ ERROR
162 error[E0387]: cannot borrow data mutably in a captured outer variable in an `Fn` closure
163 --> $DIR/mutability-errors.rs:53:14
165 LL | &mut x.0; //~ ERROR
168 help: consider changing this closure to take self by mutable reference
169 --> $DIR/mutability-errors.rs:49:12
173 LL | | x = (1,); //~ ERROR
174 LL | | x.0 = 1; //~ ERROR
175 LL | | &mut x; //~ ERROR
176 LL | | &mut x.0; //~ ERROR
180 error[E0594]: cannot assign to captured outer variable in an `Fn` closure
181 --> $DIR/mutability-errors.rs:56:9
183 LL | x = (1,); //~ ERROR
186 = note: `Fn` closures cannot capture their enclosing environment for modifications
187 help: consider changing this closure to take self by mutable reference
188 --> $DIR/mutability-errors.rs:55:12
190 LL | fn_ref(move || {
192 LL | | x = (1,); //~ ERROR
193 LL | | x.0 = 1; //~ ERROR
194 LL | | &mut x; //~ ERROR
195 LL | | &mut x.0; //~ ERROR
199 error[E0594]: cannot assign to field `x.0` of immutable binding
200 --> $DIR/mutability-errors.rs:57:9
202 LL | x.0 = 1; //~ ERROR
203 | ^^^^^^^ cannot mutably borrow field of immutable binding
205 error[E0596]: cannot borrow captured outer variable in an `Fn` closure as mutable
206 --> $DIR/mutability-errors.rs:58:14
208 LL | &mut x; //~ ERROR
211 help: consider changing this closure to take self by mutable reference
212 --> $DIR/mutability-errors.rs:55:12
214 LL | fn_ref(move || {
216 LL | | x = (1,); //~ ERROR
217 LL | | x.0 = 1; //~ ERROR
218 LL | | &mut x; //~ ERROR
219 LL | | &mut x.0; //~ ERROR
223 error[E0596]: cannot borrow field `x.0` of immutable binding as mutable
224 --> $DIR/mutability-errors.rs:59:14
226 LL | &mut x.0; //~ ERROR
227 | ^^^ cannot mutably borrow field of immutable binding
229 error[E0596]: cannot borrow immutable argument `x` as mutable
230 --> $DIR/mutability-errors.rs:64:10
232 LL | fn imm_local(x: (i32,)) {
233 | - help: make this binding mutable: `mut x`
234 LL | &mut x; //~ ERROR
235 | ^ cannot borrow mutably
237 error[E0596]: cannot borrow field `x.0` of immutable binding as mutable
238 --> $DIR/mutability-errors.rs:65:10
240 LL | fn imm_local(x: (i32,)) {
241 | - help: make this binding mutable: `mut x`
242 LL | &mut x; //~ ERROR
243 LL | &mut x.0; //~ ERROR
244 | ^^^ cannot mutably borrow field of immutable binding
246 error[E0595]: closure cannot assign to immutable argument `x`
247 --> $DIR/mutability-errors.rs:69:5
249 LL | fn imm_capture(x: (i32,)) {
250 | - help: make this binding mutable: `mut x`
252 | ^^ cannot borrow mutably
254 error[E0594]: cannot assign to captured outer variable in an `FnMut` closure
255 --> $DIR/mutability-errors.rs:76:9
257 LL | fn imm_capture(x: (i32,)) {
258 | - help: consider making `x` mutable: `mut x`
260 LL | x = (1,); //~ ERROR
263 error[E0594]: cannot assign to field `x.0` of immutable binding
264 --> $DIR/mutability-errors.rs:77:9
266 LL | x.0 = 1; //~ ERROR
267 | ^^^^^^^ cannot mutably borrow field of immutable binding
269 error[E0596]: cannot borrow captured outer variable in an `FnMut` closure as mutable
270 --> $DIR/mutability-errors.rs:78:14
272 LL | &mut x; //~ ERROR
275 error[E0596]: cannot borrow field `x.0` of immutable binding as mutable
276 --> $DIR/mutability-errors.rs:79:14
278 LL | &mut x.0; //~ ERROR
279 | ^^^ cannot mutably borrow field of immutable binding
281 error[E0594]: cannot assign to immutable static item
282 --> $DIR/mutability-errors.rs:86:5
284 LL | X = (1,); //~ ERROR
287 error[E0594]: cannot assign to field of immutable binding
288 --> $DIR/mutability-errors.rs:87:5
290 LL | X.0 = 1; //~ ERROR
291 | ^^^^^^^ cannot mutably borrow field of immutable binding
293 error[E0596]: cannot borrow immutable static item as mutable
294 --> $DIR/mutability-errors.rs:88:10
296 LL | &mut X; //~ ERROR
299 error[E0596]: cannot borrow field of immutable binding as mutable
300 --> $DIR/mutability-errors.rs:89:10
302 LL | &mut X.0; //~ ERROR
303 | ^^^ cannot mutably borrow field of immutable binding
305 error: aborting due to 35 previous errors
307 Some errors occurred: E0387, E0594, E0595, E0596.
308 For more information about an error, try `rustc --explain E0387`.