]> git.lizzy.rs Git - rust.git/blob - src/test/ui/borrowck/mutability-errors.nll.stderr
Update output for borrowck=migrate compare mode.
[rust.git] / src / test / ui / borrowck / mutability-errors.nll.stderr
1 error[E0594]: cannot assign to `*x` which is behind a `&` reference
2   --> $DIR/mutability-errors.rs:19:5
3    |
4 LL | fn named_ref(x: &(i32,)) {
5    |                 ------- help: consider changing this to be a mutable reference: `&mut (i32,)`
6 LL |     *x = (1,); //~ ERROR
7    |     ^^^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written
8
9 error[E0594]: cannot assign to `x.0` which is behind a `&` reference
10   --> $DIR/mutability-errors.rs:20:5
11    |
12 LL | fn named_ref(x: &(i32,)) {
13    |                 ------- help: consider changing this to be a mutable reference: `&mut (i32,)`
14 LL |     *x = (1,); //~ ERROR
15 LL |     x.0 = 1; //~ ERROR
16    |     ^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written
17
18 error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
19   --> $DIR/mutability-errors.rs:21:5
20    |
21 LL | fn named_ref(x: &(i32,)) {
22    |                 ------- help: consider changing this to be a mutable reference: `&mut (i32,)`
23 ...
24 LL |     &mut *x; //~ ERROR
25    |     ^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
26
27 error[E0596]: cannot borrow `x.0` as mutable, as it is behind a `&` reference
28   --> $DIR/mutability-errors.rs:22:5
29    |
30 LL | fn named_ref(x: &(i32,)) {
31    |                 ------- help: consider changing this to be a mutable reference: `&mut (i32,)`
32 ...
33 LL |     &mut x.0; //~ ERROR
34    |     ^^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
35
36 error[E0594]: cannot assign to data in a `&` reference
37   --> $DIR/mutability-errors.rs:26:5
38    |
39 LL |     *f() = (1,); //~ ERROR
40    |     ^^^^^^^^^^^ cannot assign
41
42 error[E0594]: cannot assign to data in a `&` reference
43   --> $DIR/mutability-errors.rs:27:5
44    |
45 LL |     f().0 = 1; //~ ERROR
46    |     ^^^^^^^^^ cannot assign
47
48 error[E0596]: cannot borrow data in a `&` reference as mutable
49   --> $DIR/mutability-errors.rs:28:5
50    |
51 LL |     &mut *f(); //~ ERROR
52    |     ^^^^^^^^^ cannot borrow as mutable
53
54 error[E0596]: cannot borrow data in a `&` reference as mutable
55   --> $DIR/mutability-errors.rs:29:5
56    |
57 LL |     &mut f().0; //~ ERROR
58    |     ^^^^^^^^^^ cannot borrow as mutable
59
60 error[E0594]: cannot assign to `*x` which is behind a `*const` pointer
61   --> $DIR/mutability-errors.rs:33:5
62    |
63 LL | unsafe fn named_ptr(x: *const (i32,)) {
64    |                        ------------- help: consider changing this to be a mutable pointer: `*mut (i32,)`
65 LL |     *x = (1,); //~ ERROR
66    |     ^^^^^^^^^ `x` is a `*const` pointer, so the data it refers to cannot be written
67
68 error[E0594]: cannot assign to `x.0` which is behind a `*const` pointer
69   --> $DIR/mutability-errors.rs:34:5
70    |
71 LL | unsafe fn named_ptr(x: *const (i32,)) {
72    |                        ------------- help: consider changing this to be a mutable pointer: `*mut (i32,)`
73 LL |     *x = (1,); //~ ERROR
74 LL |     (*x).0 = 1; //~ ERROR
75    |     ^^^^^^^^^^ `x` is a `*const` pointer, so the data it refers to cannot be written
76
77 error[E0596]: cannot borrow `*x` as mutable, as it is behind a `*const` pointer
78   --> $DIR/mutability-errors.rs:35:5
79    |
80 LL | unsafe fn named_ptr(x: *const (i32,)) {
81    |                        ------------- help: consider changing this to be a mutable pointer: `*mut (i32,)`
82 ...
83 LL |     &mut *x; //~ ERROR
84    |     ^^^^^^^ `x` is a `*const` pointer, so the data it refers to cannot be borrowed as mutable
85
86 error[E0596]: cannot borrow `x.0` as mutable, as it is behind a `*const` pointer
87   --> $DIR/mutability-errors.rs:36:5
88    |
89 LL | unsafe fn named_ptr(x: *const (i32,)) {
90    |                        ------------- help: consider changing this to be a mutable pointer: `*mut (i32,)`
91 ...
92 LL |     &mut (*x).0; //~ ERROR
93    |     ^^^^^^^^^^^ `x` is a `*const` pointer, so the data it refers to cannot be borrowed as mutable
94
95 error[E0594]: cannot assign to data in a `*const` pointer
96   --> $DIR/mutability-errors.rs:40:5
97    |
98 LL |     *f() = (1,); //~ ERROR
99    |     ^^^^^^^^^^^ cannot assign
100
101 error[E0594]: cannot assign to data in a `*const` pointer
102   --> $DIR/mutability-errors.rs:41:5
103    |
104 LL |     (*f()).0 = 1; //~ ERROR
105    |     ^^^^^^^^^^^^ cannot assign
106
107 error[E0596]: cannot borrow data in a `*const` pointer as mutable
108   --> $DIR/mutability-errors.rs:42:5
109    |
110 LL |     &mut *f(); //~ ERROR
111    |     ^^^^^^^^^ cannot borrow as mutable
112
113 error[E0596]: cannot borrow data in a `*const` pointer as mutable
114   --> $DIR/mutability-errors.rs:43:5
115    |
116 LL |     &mut (*f()).0; //~ ERROR
117    |     ^^^^^^^^^^^^^ cannot borrow as mutable
118
119 error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure
120   --> $DIR/mutability-errors.rs:50:9
121    |
122 LL |         x = (1,); //~ ERROR
123    |         ^^^^^^^^ cannot assign
124    |
125 help: consider changing this to accept closures that implement `FnMut`
126   --> $DIR/mutability-errors.rs:49:12
127    |
128 LL |       fn_ref(|| {
129    |  ____________^
130 LL | |         x = (1,); //~ ERROR
131 LL | |         x.0 = 1; //~ ERROR
132 LL | |         &mut x; //~ ERROR
133 LL | |         &mut x.0; //~ ERROR
134 LL | |     });
135    | |_____^
136
137 error[E0594]: cannot assign to `x.0`, as `Fn` closures cannot mutate their captured variables
138   --> $DIR/mutability-errors.rs:51:9
139    |
140 LL |         x.0 = 1; //~ ERROR
141    |         ^^^^^^^ cannot assign
142    |
143 help: consider changing this to accept closures that implement `FnMut`
144   --> $DIR/mutability-errors.rs:49:12
145    |
146 LL |       fn_ref(|| {
147    |  ____________^
148 LL | |         x = (1,); //~ ERROR
149 LL | |         x.0 = 1; //~ ERROR
150 LL | |         &mut x; //~ ERROR
151 LL | |         &mut x.0; //~ ERROR
152 LL | |     });
153    | |_____^
154
155 error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
156   --> $DIR/mutability-errors.rs:52:9
157    |
158 LL |         &mut x; //~ ERROR
159    |         ^^^^^^ cannot borrow as mutable
160    |
161 help: consider changing this to accept closures that implement `FnMut`
162   --> $DIR/mutability-errors.rs:49:12
163    |
164 LL |       fn_ref(|| {
165    |  ____________^
166 LL | |         x = (1,); //~ ERROR
167 LL | |         x.0 = 1; //~ ERROR
168 LL | |         &mut x; //~ ERROR
169 LL | |         &mut x.0; //~ ERROR
170 LL | |     });
171    | |_____^
172
173 error[E0596]: cannot borrow `x.0` as mutable, as `Fn` closures cannot mutate their captured variables
174   --> $DIR/mutability-errors.rs:53:9
175    |
176 LL |         &mut x.0; //~ ERROR
177    |         ^^^^^^^^ cannot borrow as mutable
178    |
179 help: consider changing this to accept closures that implement `FnMut`
180   --> $DIR/mutability-errors.rs:49:12
181    |
182 LL |       fn_ref(|| {
183    |  ____________^
184 LL | |         x = (1,); //~ ERROR
185 LL | |         x.0 = 1; //~ ERROR
186 LL | |         &mut x; //~ ERROR
187 LL | |         &mut x.0; //~ ERROR
188 LL | |     });
189    | |_____^
190
191 error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure
192   --> $DIR/mutability-errors.rs:56:9
193    |
194 LL |         x = (1,); //~ ERROR
195    |         ^^^^^^^^ cannot assign
196    |
197 help: consider changing this to accept closures that implement `FnMut`
198   --> $DIR/mutability-errors.rs:55:12
199    |
200 LL |       fn_ref(move || {
201    |  ____________^
202 LL | |         x = (1,); //~ ERROR
203 LL | |         x.0 = 1; //~ ERROR
204 LL | |         &mut x; //~ ERROR
205 LL | |         &mut x.0; //~ ERROR
206 LL | |     });
207    | |_____^
208
209 error[E0594]: cannot assign to `x.0`, as `Fn` closures cannot mutate their captured variables
210   --> $DIR/mutability-errors.rs:57:9
211    |
212 LL |         x.0 = 1; //~ ERROR
213    |         ^^^^^^^ cannot assign
214    |
215 help: consider changing this to accept closures that implement `FnMut`
216   --> $DIR/mutability-errors.rs:55:12
217    |
218 LL |       fn_ref(move || {
219    |  ____________^
220 LL | |         x = (1,); //~ ERROR
221 LL | |         x.0 = 1; //~ ERROR
222 LL | |         &mut x; //~ ERROR
223 LL | |         &mut x.0; //~ ERROR
224 LL | |     });
225    | |_____^
226
227 error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
228   --> $DIR/mutability-errors.rs:58:9
229    |
230 LL |         &mut x; //~ ERROR
231    |         ^^^^^^ cannot borrow as mutable
232    |
233 help: consider changing this to accept closures that implement `FnMut`
234   --> $DIR/mutability-errors.rs:55:12
235    |
236 LL |       fn_ref(move || {
237    |  ____________^
238 LL | |         x = (1,); //~ ERROR
239 LL | |         x.0 = 1; //~ ERROR
240 LL | |         &mut x; //~ ERROR
241 LL | |         &mut x.0; //~ ERROR
242 LL | |     });
243    | |_____^
244
245 error[E0596]: cannot borrow `x.0` as mutable, as `Fn` closures cannot mutate their captured variables
246   --> $DIR/mutability-errors.rs:59:9
247    |
248 LL |         &mut x.0; //~ ERROR
249    |         ^^^^^^^^ cannot borrow as mutable
250    |
251 help: consider changing this to accept closures that implement `FnMut`
252   --> $DIR/mutability-errors.rs:55:12
253    |
254 LL |       fn_ref(move || {
255    |  ____________^
256 LL | |         x = (1,); //~ ERROR
257 LL | |         x.0 = 1; //~ ERROR
258 LL | |         &mut x; //~ ERROR
259 LL | |         &mut x.0; //~ ERROR
260 LL | |     });
261    | |_____^
262
263 error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
264   --> $DIR/mutability-errors.rs:64:5
265    |
266 LL | fn imm_local(x: (i32,)) {
267    |              - help: consider changing this to be mutable: `mut x`
268 LL |     &mut x; //~ ERROR
269    |     ^^^^^^ cannot borrow as mutable
270
271 error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable
272   --> $DIR/mutability-errors.rs:65:5
273    |
274 LL | fn imm_local(x: (i32,)) {
275    |              - help: consider changing this to be mutable: `mut x`
276 LL |     &mut x; //~ ERROR
277 LL |     &mut x.0; //~ ERROR
278    |     ^^^^^^^^ cannot borrow as mutable
279
280 warning[E0594]: cannot assign to `x`, as it is not declared as mutable
281   --> $DIR/mutability-errors.rs:70:9
282    |
283 LL | fn imm_capture(x: (i32,)) {
284    |                - help: consider changing this to be mutable: `mut x`
285 LL |     || { //~ ERROR
286 LL |         x = (1,);
287    |         ^^^^^^^^ cannot assign
288    |
289    = warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
290            It represents potential unsoundness in your code.
291            This warning will become a hard error in the future.
292
293 warning[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable
294   --> $DIR/mutability-errors.rs:71:9
295    |
296 LL | fn imm_capture(x: (i32,)) {
297    |                - help: consider changing this to be mutable: `mut x`
298 ...
299 LL |         x.0 = 1;
300    |         ^^^^^^^ cannot assign
301    |
302    = warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
303            It represents potential unsoundness in your code.
304            This warning will become a hard error in the future.
305
306 warning[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
307   --> $DIR/mutability-errors.rs:72:9
308    |
309 LL | fn imm_capture(x: (i32,)) {
310    |                - help: consider changing this to be mutable: `mut x`
311 ...
312 LL |         &mut x;
313    |         ^^^^^^ cannot borrow as mutable
314    |
315    = warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
316            It represents potential unsoundness in your code.
317            This warning will become a hard error in the future.
318
319 warning[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable
320   --> $DIR/mutability-errors.rs:73:9
321    |
322 LL | fn imm_capture(x: (i32,)) {
323    |                - help: consider changing this to be mutable: `mut x`
324 ...
325 LL |         &mut x.0;
326    |         ^^^^^^^^ cannot borrow as mutable
327    |
328    = warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
329            It represents potential unsoundness in your code.
330            This warning will become a hard error in the future.
331
332 error[E0594]: cannot assign to `x`, as it is not declared as mutable
333   --> $DIR/mutability-errors.rs:76:9
334    |
335 LL | fn imm_capture(x: (i32,)) {
336    |                - help: consider changing this to be mutable: `mut x`
337 ...
338 LL |         x = (1,); //~ ERROR
339    |         ^^^^^^^^ cannot assign
340
341 error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable
342   --> $DIR/mutability-errors.rs:77:9
343    |
344 LL | fn imm_capture(x: (i32,)) {
345    |                - help: consider changing this to be mutable: `mut x`
346 ...
347 LL |         x.0 = 1; //~ ERROR
348    |         ^^^^^^^ cannot assign
349
350 error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
351   --> $DIR/mutability-errors.rs:78:9
352    |
353 LL | fn imm_capture(x: (i32,)) {
354    |                - help: consider changing this to be mutable: `mut x`
355 ...
356 LL |         &mut x; //~ ERROR
357    |         ^^^^^^ cannot borrow as mutable
358
359 error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable
360   --> $DIR/mutability-errors.rs:79:9
361    |
362 LL | fn imm_capture(x: (i32,)) {
363    |                - help: consider changing this to be mutable: `mut x`
364 ...
365 LL |         &mut x.0; //~ ERROR
366    |         ^^^^^^^^ cannot borrow as mutable
367
368 error[E0594]: cannot assign to immutable static item `X`
369   --> $DIR/mutability-errors.rs:86:5
370    |
371 LL |     X = (1,); //~ ERROR
372    |     ^^^^^^^^ cannot assign
373
374 error[E0594]: cannot assign to `X.0`, as `X` is an immutable static item
375   --> $DIR/mutability-errors.rs:87:5
376    |
377 LL |     X.0 = 1; //~ ERROR
378    |     ^^^^^^^ cannot assign
379
380 error[E0596]: cannot borrow immutable static item `X` as mutable
381   --> $DIR/mutability-errors.rs:88:5
382    |
383 LL |     &mut X; //~ ERROR
384    |     ^^^^^^ cannot borrow as mutable
385
386 error[E0596]: cannot borrow `X.0` as mutable, as `X` is an immutable static item
387   --> $DIR/mutability-errors.rs:89:5
388    |
389 LL |     &mut X.0; //~ ERROR
390    |     ^^^^^^^^ cannot borrow as mutable
391
392 error: aborting due to 34 previous errors
393
394 Some errors occurred: E0594, E0596.
395 For more information about an error, try `rustc --explain E0594`.