fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
14.3 KiB448 linesraw
1error[E0507]: cannot move out of `x.0`, as `x` is a captured variable in an `Fn` closure
2  --> $DIR/move-into-closure.rs:28:21
3   |
4LL |     let x = X(Y);
5   |         - captured outer variable
6...
7LL |     consume_fn(|| {
8   |                -- captured by this `Fn` closure
9LL |         let X(_t) = x;
10   |               --    ^
11   |               |
12   |               data moved here
13   |               move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
14   |
15help: consider borrowing here
16   |
17LL |         let X(_t) = &x;
18   |                     +
19
20error[E0507]: cannot move out of `e.0`, as `e` is a captured variable in an `Fn` closure
21  --> $DIR/move-into-closure.rs:31:34
22   |
23LL |     let e = Either::One(X(Y));
24   |         - captured outer variable
25...
26LL |     consume_fn(|| {
27   |                -- captured by this `Fn` closure
28...
29LL |         if let Either::One(_t) = e { }
30   |                            --    ^
31   |                            |
32   |                            data moved here
33   |                            move occurs because `_t` has type `X`, which does not implement the `Copy` trait
34   |
35help: consider borrowing here
36   |
37LL |         if let Either::One(_t) = &e { }
38   |                                  +
39
40error[E0507]: cannot move out of `e.0`, as `e` is a captured variable in an `Fn` closure
41  --> $DIR/move-into-closure.rs:34:37
42   |
43LL |     let e = Either::One(X(Y));
44   |         - captured outer variable
45...
46LL |     consume_fn(|| {
47   |                -- captured by this `Fn` closure
48...
49LL |         while let Either::One(_t) = e { }
50   |                               --    ^
51   |                               |
52   |                               data moved here
53   |                               move occurs because `_t` has type `X`, which does not implement the `Copy` trait
54   |
55help: consider borrowing here
56   |
57LL |         while let Either::One(_t) = &e { }
58   |                                     +
59
60error[E0507]: cannot move out of `e.0`, as `e` is a captured variable in an `Fn` closure
61  --> $DIR/move-into-closure.rs:37:15
62   |
63LL |     let e = Either::One(X(Y));
64   |         - captured outer variable
65...
66LL |     consume_fn(|| {
67   |                -- captured by this `Fn` closure
68...
69LL |         match e {
70   |               ^
71...
72LL |             Either::One(_t)
73   |                         --
74   |                         |
75   |                         data moved here
76   |                         move occurs because `_t` has type `X`, which does not implement the `Copy` trait
77   |
78help: consider borrowing here
79   |
80LL |         match &e {
81   |               +
82
83error[E0507]: cannot move out of `e.0`, as `e` is a captured variable in an `Fn` closure
84  --> $DIR/move-into-closure.rs:43:15
85   |
86LL |     let e = Either::One(X(Y));
87   |         - captured outer variable
88...
89LL |     consume_fn(|| {
90   |                -- captured by this `Fn` closure
91...
92LL |         match e {
93   |               ^
94...
95LL |             Either::One(_t) => (),
96   |                         --
97   |                         |
98   |                         data moved here
99   |                         move occurs because `_t` has type `X`, which does not implement the `Copy` trait
100   |
101help: consider borrowing here
102   |
103LL |         match &e {
104   |               +
105
106error[E0507]: cannot move out of `x.0`, as `x` is a captured variable in an `Fn` closure
107  --> $DIR/move-into-closure.rs:51:25
108   |
109LL |     let x = X(Y);
110   |         - captured outer variable
111...
112LL |     consume_fn(|| {
113   |                -- captured by this `Fn` closure
114...
115LL |         let X(mut _t) = x;
116   |               ------    ^
117   |               |
118   |               data moved here
119   |               move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
120   |
121help: consider borrowing here
122   |
123LL |         let X(mut _t) = &x;
124   |                         +
125
126error[E0507]: cannot move out of `em.0`, as `em` is a captured variable in an `Fn` closure
127  --> $DIR/move-into-closure.rs:54:38
128   |
129LL |     let mut em = Either::One(X(Y));
130   |         ------ captured outer variable
131...
132LL |     consume_fn(|| {
133   |                -- captured by this `Fn` closure
134...
135LL |         if let Either::One(mut _t) = em { }
136   |                            ------    ^^
137   |                            |
138   |                            data moved here
139   |                            move occurs because `_t` has type `X`, which does not implement the `Copy` trait
140   |
141help: consider borrowing here
142   |
143LL |         if let Either::One(mut _t) = &em { }
144   |                                      +
145
146error[E0507]: cannot move out of `em.0`, as `em` is a captured variable in an `Fn` closure
147  --> $DIR/move-into-closure.rs:57:41
148   |
149LL |     let mut em = Either::One(X(Y));
150   |         ------ captured outer variable
151...
152LL |     consume_fn(|| {
153   |                -- captured by this `Fn` closure
154...
155LL |         while let Either::One(mut _t) = em { }
156   |                               ------    ^^
157   |                               |
158   |                               data moved here
159   |                               move occurs because `_t` has type `X`, which does not implement the `Copy` trait
160   |
161help: consider borrowing here
162   |
163LL |         while let Either::One(mut _t) = &em { }
164   |                                         +
165
166error[E0507]: cannot move out of `em.0`, as `em` is a captured variable in an `Fn` closure
167  --> $DIR/move-into-closure.rs:60:15
168   |
169LL |     let mut em = Either::One(X(Y));
170   |         ------ captured outer variable
171...
172LL |     consume_fn(|| {
173   |                -- captured by this `Fn` closure
174...
175LL |         match em {
176   |               ^^
177...
178LL |             Either::One(mut _t)
179   |                         ------
180   |                         |
181   |                         data moved here
182   |                         move occurs because `_t` has type `X`, which does not implement the `Copy` trait
183   |
184help: consider borrowing here
185   |
186LL |         match &em {
187   |               +
188
189error[E0507]: cannot move out of `em.0`, as `em` is a captured variable in an `Fn` closure
190  --> $DIR/move-into-closure.rs:66:15
191   |
192LL |     let mut em = Either::One(X(Y));
193   |         ------ captured outer variable
194...
195LL |     consume_fn(|| {
196   |                -- captured by this `Fn` closure
197...
198LL |         match em {
199   |               ^^
200...
201LL |             Either::One(mut _t) => (),
202   |                         ------
203   |                         |
204   |                         data moved here
205   |                         move occurs because `_t` has type `X`, which does not implement the `Copy` trait
206   |
207help: consider borrowing here
208   |
209LL |         match &em {
210   |               +
211
212error[E0507]: cannot move out of `x.0`, as `x` is a captured variable in an `FnMut` closure
213  --> $DIR/move-into-closure.rs:85:21
214   |
215LL |     let x = X(Y);
216   |         - captured outer variable
217...
218LL |     consume_fnmut(|| {
219   |                   -- captured by this `FnMut` closure
220LL |         let X(_t) = x;
221   |               --    ^
222   |               |
223   |               data moved here
224   |               move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
225   |
226help: consider borrowing here
227   |
228LL |         let X(_t) = &x;
229   |                     +
230
231error[E0507]: cannot move out of `e.0`, as `e` is a captured variable in an `FnMut` closure
232  --> $DIR/move-into-closure.rs:88:34
233   |
234LL |     let e = Either::One(X(Y));
235   |         - captured outer variable
236...
237LL |     consume_fnmut(|| {
238   |                   -- captured by this `FnMut` closure
239...
240LL |         if let Either::One(_t) = e { }
241   |                            --    ^
242   |                            |
243   |                            data moved here
244   |                            move occurs because `_t` has type `X`, which does not implement the `Copy` trait
245   |
246help: consider borrowing here
247   |
248LL |         if let Either::One(_t) = &e { }
249   |                                  +
250
251error[E0507]: cannot move out of `e.0`, as `e` is a captured variable in an `FnMut` closure
252  --> $DIR/move-into-closure.rs:91:37
253   |
254LL |     let e = Either::One(X(Y));
255   |         - captured outer variable
256...
257LL |     consume_fnmut(|| {
258   |                   -- captured by this `FnMut` closure
259...
260LL |         while let Either::One(_t) = e { }
261   |                               --    ^
262   |                               |
263   |                               data moved here
264   |                               move occurs because `_t` has type `X`, which does not implement the `Copy` trait
265   |
266help: consider borrowing here
267   |
268LL |         while let Either::One(_t) = &e { }
269   |                                     +
270
271error[E0507]: cannot move out of `e.0`, as `e` is a captured variable in an `FnMut` closure
272  --> $DIR/move-into-closure.rs:94:15
273   |
274LL |     let e = Either::One(X(Y));
275   |         - captured outer variable
276...
277LL |     consume_fnmut(|| {
278   |                   -- captured by this `FnMut` closure
279...
280LL |         match e {
281   |               ^
282...
283LL |             Either::One(_t)
284   |                         --
285   |                         |
286   |                         data moved here
287   |                         move occurs because `_t` has type `X`, which does not implement the `Copy` trait
288   |
289help: consider borrowing here
290   |
291LL |         match &e {
292   |               +
293
294error[E0507]: cannot move out of `e.0`, as `e` is a captured variable in an `FnMut` closure
295  --> $DIR/move-into-closure.rs:100:15
296   |
297LL |     let e = Either::One(X(Y));
298   |         - captured outer variable
299...
300LL |     consume_fnmut(|| {
301   |                   -- captured by this `FnMut` closure
302...
303LL |         match e {
304   |               ^
305...
306LL |             Either::One(_t) => (),
307   |                         --
308   |                         |
309   |                         data moved here
310   |                         move occurs because `_t` has type `X`, which does not implement the `Copy` trait
311   |
312help: consider borrowing here
313   |
314LL |         match &e {
315   |               +
316
317error[E0507]: cannot move out of `x.0`, as `x` is a captured variable in an `FnMut` closure
318  --> $DIR/move-into-closure.rs:108:25
319   |
320LL |     let x = X(Y);
321   |         - captured outer variable
322...
323LL |     consume_fnmut(|| {
324   |                   -- captured by this `FnMut` closure
325...
326LL |         let X(mut _t) = x;
327   |               ------    ^
328   |               |
329   |               data moved here
330   |               move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
331   |
332help: consider borrowing here
333   |
334LL |         let X(mut _t) = &x;
335   |                         +
336
337error[E0507]: cannot move out of `em.0`, as `em` is a captured variable in an `FnMut` closure
338  --> $DIR/move-into-closure.rs:111:38
339   |
340LL |     let mut em = Either::One(X(Y));
341   |         ------ captured outer variable
342...
343LL |     consume_fnmut(|| {
344   |                   -- captured by this `FnMut` closure
345...
346LL |         if let Either::One(mut _t) = em { }
347   |                            ------    ^^
348   |                            |
349   |                            data moved here
350   |                            move occurs because `_t` has type `X`, which does not implement the `Copy` trait
351   |
352help: consider borrowing here
353   |
354LL |         if let Either::One(mut _t) = &em { }
355   |                                      +
356
357error[E0507]: cannot move out of `em.0`, as `em` is a captured variable in an `FnMut` closure
358  --> $DIR/move-into-closure.rs:114:41
359   |
360LL |     let mut em = Either::One(X(Y));
361   |         ------ captured outer variable
362...
363LL |     consume_fnmut(|| {
364   |                   -- captured by this `FnMut` closure
365...
366LL |         while let Either::One(mut _t) = em { }
367   |                               ------    ^^
368   |                               |
369   |                               data moved here
370   |                               move occurs because `_t` has type `X`, which does not implement the `Copy` trait
371   |
372help: consider borrowing here
373   |
374LL |         while let Either::One(mut _t) = &em { }
375   |                                         +
376
377error[E0507]: cannot move out of `em.0`, as `em` is a captured variable in an `FnMut` closure
378  --> $DIR/move-into-closure.rs:117:15
379   |
380LL |     let mut em = Either::One(X(Y));
381   |         ------ captured outer variable
382...
383LL |     consume_fnmut(|| {
384   |                   -- captured by this `FnMut` closure
385...
386LL |         match em {
387   |               ^^
388...
389LL |             Either::One(mut _t)
390   |                         ------
391   |                         |
392   |                         data moved here
393   |                         move occurs because `_t` has type `X`, which does not implement the `Copy` trait
394   |
395help: consider borrowing here
396   |
397LL |         match &em {
398   |               +
399
400error[E0507]: cannot move out of `em.0`, as `em` is a captured variable in an `FnMut` closure
401  --> $DIR/move-into-closure.rs:123:15
402   |
403LL |     let mut em = Either::One(X(Y));
404   |         ------ captured outer variable
405...
406LL |     consume_fnmut(|| {
407   |                   -- captured by this `FnMut` closure
408...
409LL |         match em {
410   |               ^^
411...
412LL |             Either::One(mut _t) => (),
413   |                         ------
414   |                         |
415   |                         data moved here
416   |                         move occurs because `_t` has type `X`, which does not implement the `Copy` trait
417   |
418help: consider borrowing here
419   |
420LL |         match &em {
421   |               +
422
423error[E0507]: cannot move out of `em.0`, as `em` is a captured variable in an `FnMut` closure
424  --> $DIR/move-into-closure.rs:130:15
425   |
426LL |     let mut em = Either::One(X(Y));
427   |         ------ captured outer variable
428...
429LL |     consume_fnmut(|| {
430   |                   -- captured by this `FnMut` closure
431...
432LL |         match em {
433   |               ^^
434...
435LL |             Either::One(mut _t) => (),
436   |                         ------
437   |                         |
438   |                         data moved here
439   |                         move occurs because `_t` has type `X`, which does not implement the `Copy` trait
440   |
441help: consider borrowing here
442   |
443LL |         match &em {
444   |               +
445
446error: aborting due to 21 previous errors
447
448For more information about this error, try `rustc --explain E0507`.