]> git.proxmox.com Git - rustc.git/blob - src/test/ui/pattern/move-ref-patterns/borrowck-move-ref-pattern.stderr
Update unsuspicious file list
[rustc.git] / src / test / ui / pattern / move-ref-patterns / borrowck-move-ref-pattern.stderr
1 error[E0505]: cannot move out of `arr[..]` because it is borrowed
2 --> $DIR/borrowck-move-ref-pattern.rs:8:24
3 |
4 LL | let hold_all = &arr;
5 | ---- borrow of `arr` occurs here
6 LL | let [ref _x0_hold, _x1, ref xs_hold @ ..] = arr;
7 | ^^^ move out of `arr[..]` occurs here
8 LL | _x1 = U;
9 LL | drop(hold_all);
10 | -------- borrow later used here
11
12 error[E0384]: cannot assign twice to immutable variable `_x1`
13 --> $DIR/borrowck-move-ref-pattern.rs:9:5
14 |
15 LL | let [ref _x0_hold, _x1, ref xs_hold @ ..] = arr;
16 | ---
17 | |
18 | first assignment to `_x1`
19 | help: consider making this binding mutable: `mut _x1`
20 LL | _x1 = U;
21 | ^^^^^^^ cannot assign twice to immutable variable
22
23 error[E0505]: cannot move out of `arr[..]` because it is borrowed
24 --> $DIR/borrowck-move-ref-pattern.rs:11:10
25 |
26 LL | let [ref _x0_hold, _x1, ref xs_hold @ ..] = arr;
27 | ------------ borrow of `arr[..]` occurs here
28 ...
29 LL | let [_x0, ..] = arr;
30 | ^^^ move out of `arr[..]` occurs here
31 LL | drop(_x0_hold);
32 | -------- borrow later used here
33
34 error[E0502]: cannot borrow `arr[..]` as mutable because it is also borrowed as immutable
35 --> $DIR/borrowck-move-ref-pattern.rs:13:16
36 |
37 LL | let [ref _x0_hold, _x1, ref xs_hold @ ..] = arr;
38 | ----------- immutable borrow occurs here
39 ...
40 LL | let [_, _, ref mut _x2, _x3, mut _x4] = arr;
41 | ^^^^^^^^^^^ mutable borrow occurs here
42 ...
43 LL | drop(xs_hold);
44 | ------- immutable borrow later used here
45
46 error[E0505]: cannot move out of `arr[..]` because it is borrowed
47 --> $DIR/borrowck-move-ref-pattern.rs:13:29
48 |
49 LL | let [ref _x0_hold, _x1, ref xs_hold @ ..] = arr;
50 | ----------- borrow of `arr[..]` occurs here
51 ...
52 LL | let [_, _, ref mut _x2, _x3, mut _x4] = arr;
53 | ^^^ move out of `arr[..]` occurs here
54 ...
55 LL | drop(xs_hold);
56 | ------- borrow later used here
57
58 error[E0505]: cannot move out of `arr[..]` because it is borrowed
59 --> $DIR/borrowck-move-ref-pattern.rs:13:34
60 |
61 LL | let [ref _x0_hold, _x1, ref xs_hold @ ..] = arr;
62 | ----------- borrow of `arr[..]` occurs here
63 ...
64 LL | let [_, _, ref mut _x2, _x3, mut _x4] = arr;
65 | ^^^^^^^ move out of `arr[..]` occurs here
66 ...
67 LL | drop(xs_hold);
68 | ------- borrow later used here
69
70 error[E0384]: cannot assign twice to immutable variable `_x1`
71 --> $DIR/borrowck-move-ref-pattern.rs:23:5
72 |
73 LL | let (ref _x0, _x1, ref _x2, ..) = tup;
74 | ---
75 | |
76 | first assignment to `_x1`
77 | help: consider making this binding mutable: `mut _x1`
78 LL | _x1 = U;
79 | ^^^^^^^ cannot assign twice to immutable variable
80
81 error[E0502]: cannot borrow `tup.0` as mutable because it is also borrowed as immutable
82 --> $DIR/borrowck-move-ref-pattern.rs:24:20
83 |
84 LL | let (ref _x0, _x1, ref _x2, ..) = tup;
85 | ------- immutable borrow occurs here
86 LL | _x1 = U;
87 LL | let _x0_hold = &mut tup.0;
88 | ^^^^^^^^^^ mutable borrow occurs here
89 LL | let (ref mut _x0_hold, ..) = tup;
90 LL | *_x0 = U;
91 | -------- immutable borrow later used here
92
93 error[E0502]: cannot borrow `tup.0` as mutable because it is also borrowed as immutable
94 --> $DIR/borrowck-move-ref-pattern.rs:25:10
95 |
96 LL | let (ref _x0, _x1, ref _x2, ..) = tup;
97 | ------- immutable borrow occurs here
98 ...
99 LL | let (ref mut _x0_hold, ..) = tup;
100 | ^^^^^^^^^^^^^^^^ mutable borrow occurs here
101 LL | *_x0 = U;
102 | -------- immutable borrow later used here
103
104 error[E0594]: cannot assign to `*_x0`, which is behind a `&` reference
105 --> $DIR/borrowck-move-ref-pattern.rs:26:5
106 |
107 LL | let (ref _x0, _x1, ref _x2, ..) = tup;
108 | ------- help: consider changing this to be a mutable reference: `ref mut _x0`
109 ...
110 LL | *_x0 = U;
111 | ^^^^^^^^ `_x0` is a `&` reference, so the data it refers to cannot be written
112
113 error[E0594]: cannot assign to `*_x2`, which is behind a `&` reference
114 --> $DIR/borrowck-move-ref-pattern.rs:27:5
115 |
116 LL | let (ref _x0, _x1, ref _x2, ..) = tup;
117 | ------- help: consider changing this to be a mutable reference: `ref mut _x2`
118 ...
119 LL | *_x2 = U;
120 | ^^^^^^^^ `_x2` is a `&` reference, so the data it refers to cannot be written
121
122 error[E0382]: use of moved value: `tup.1`
123 --> $DIR/borrowck-move-ref-pattern.rs:28:10
124 |
125 LL | let (ref _x0, _x1, ref _x2, ..) = tup;
126 | --- value moved here
127 ...
128 LL | drop(tup.1);
129 | ^^^^^ value used here after move
130 |
131 = note: move occurs because `tup.1` has type `U`, which does not implement the `Copy` trait
132 help: borrow this binding in the pattern to avoid moving the value
133 |
134 LL | let (ref _x0, ref _x1, ref _x2, ..) = tup;
135 | +++
136
137 error[E0382]: borrow of moved value: `tup.1`
138 --> $DIR/borrowck-move-ref-pattern.rs:29:20
139 |
140 LL | drop(tup.1);
141 | ----- value moved here
142 LL | let _x1_hold = &tup.1;
143 | ^^^^^^ value borrowed here after move
144 |
145 = note: move occurs because `tup.1` has type `U`, which does not implement the `Copy` trait
146
147 error[E0502]: cannot borrow `tup.3` as immutable because it is also borrowed as mutable
148 --> $DIR/borrowck-move-ref-pattern.rs:31:20
149 |
150 LL | let (.., ref mut _x3) = tup;
151 | ----------- mutable borrow occurs here
152 LL | let _x3_hold = &tup.3;
153 | ^^^^^^ immutable borrow occurs here
154 ...
155 LL | drop(_x3);
156 | --- mutable borrow later used here
157
158 error[E0499]: cannot borrow `tup.3` as mutable more than once at a time
159 --> $DIR/borrowck-move-ref-pattern.rs:32:20
160 |
161 LL | let (.., ref mut _x3) = tup;
162 | ----------- first mutable borrow occurs here
163 LL | let _x3_hold = &tup.3;
164 LL | let _x3_hold = &mut tup.3;
165 | ^^^^^^^^^^ second mutable borrow occurs here
166 ...
167 LL | drop(_x3);
168 | --- first borrow later used here
169
170 error[E0499]: cannot borrow `tup.3` as mutable more than once at a time
171 --> $DIR/borrowck-move-ref-pattern.rs:33:14
172 |
173 LL | let (.., ref mut _x3) = tup;
174 | ----------- first mutable borrow occurs here
175 ...
176 LL | let (.., ref mut _x4_hold) = tup;
177 | ^^^^^^^^^^^^^^^^ second mutable borrow occurs here
178 LL | let (.., ref _x4_hold) = tup;
179 LL | drop(_x3);
180 | --- first borrow later used here
181
182 error[E0502]: cannot borrow `tup.3` as immutable because it is also borrowed as mutable
183 --> $DIR/borrowck-move-ref-pattern.rs:34:14
184 |
185 LL | let (.., ref mut _x3) = tup;
186 | ----------- mutable borrow occurs here
187 ...
188 LL | let (.., ref _x4_hold) = tup;
189 | ^^^^^^^^^^^^ immutable borrow occurs here
190 LL | drop(_x3);
191 | --- mutable borrow later used here
192
193 error[E0382]: use of moved value: `tup`
194 --> $DIR/borrowck-move-ref-pattern.rs:43:14
195 |
196 LL | let mut tup = (U, U, U);
197 | ------- move occurs because `tup` has type `(U, U, U)`, which does not implement the `Copy` trait
198 LL | let c1 = || {
199 | -- value moved into closure here
200 LL | let (ref _x0, _x1, _) = tup;
201 | --- variable moved due to use in closure
202 LL | };
203 LL | let c2 = || {
204 | ^^ value used here after move
205 LL |
206 LL | let (ref mut _x0, _, _x2) = tup;
207 | --- use occurs due to use in closure
208
209 error: aborting due to 18 previous errors
210
211 Some errors have detailed explanations: E0382, E0384, E0499, E0502, E0505, E0594.
212 For more information about an error, try `rustc --explain E0382`.