]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/borrowck-multiple-captures.stderr
Rollup merge of #106323 - starkat99:stabilize-f16c_target_feature, r=petrochenkov
[rust.git] / tests / ui / borrowck / borrowck-multiple-captures.stderr
1 error[E0505]: cannot move out of `x1` because it is borrowed
2   --> $DIR/borrowck-multiple-captures.rs:12:19
3    |
4 LL |     let p1 = &x1;
5    |              --- borrow of `x1` occurs here
6 ...
7 LL |     thread::spawn(move|| {
8    |                   ^^^^^^ move out of `x1` occurs here
9 ...
10 LL |         drop(x1);
11    |              -- move occurs due to use in closure
12 ...
13 LL |     borrow(&*p1);
14    |            ---- borrow later used here
15
16 error[E0505]: cannot move out of `x2` because it is borrowed
17   --> $DIR/borrowck-multiple-captures.rs:12:19
18    |
19 LL |     let p2 = &x2;
20    |              --- borrow of `x2` occurs here
21 LL |     thread::spawn(move|| {
22    |                   ^^^^^^ move out of `x2` occurs here
23 ...
24 LL |         drop(x2);
25    |              -- move occurs due to use in closure
26 ...
27 LL |     borrow(&*p2);
28    |            ---- borrow later used here
29
30 error[E0382]: use of moved value: `x1`
31   --> $DIR/borrowck-multiple-captures.rs:27:19
32    |
33 LL |     let x1: Box<_> = Box::new(1);
34    |         -- move occurs because `x1` has type `Box<i32>`, which does not implement the `Copy` trait
35 LL |     drop(x1);
36    |          -- value moved here
37 ...
38 LL |     thread::spawn(move|| {
39    |                   ^^^^^^ value used here after move
40 ...
41 LL |         drop(x1);
42    |              -- use occurs due to use in closure
43    |
44 help: consider cloning the value if the performance cost is acceptable
45    |
46 LL |     drop(x1.clone());
47    |            ++++++++
48
49 error[E0382]: use of moved value: `x2`
50   --> $DIR/borrowck-multiple-captures.rs:27:19
51    |
52 LL |     let x2: Box<_> = Box::new(2);
53    |         -- move occurs because `x2` has type `Box<i32>`, which does not implement the `Copy` trait
54 LL |     drop(x2);
55    |          -- value moved here
56 LL |     thread::spawn(move|| {
57    |                   ^^^^^^ value used here after move
58 ...
59 LL |         drop(x2);
60    |              -- use occurs due to use in closure
61    |
62 help: consider cloning the value if the performance cost is acceptable
63    |
64 LL |     drop(x2.clone());
65    |            ++++++++
66
67 error[E0382]: use of moved value: `x`
68   --> $DIR/borrowck-multiple-captures.rs:41:14
69    |
70 LL |         drop(x);
71    |              - value moved here
72 LL |         drop(x);
73    |              ^ value used here after move
74    |
75    = note: move occurs because `x` has type `Box<i32>`, which does not implement the `Copy` trait
76
77 error[E0505]: cannot move out of `x` because it is borrowed
78   --> $DIR/borrowck-multiple-captures.rs:38:19
79    |
80 LL |     let p = &x;
81    |             -- borrow of `x` occurs here
82 LL |     thread::spawn(move|| {
83    |                   ^^^^^^ move out of `x` occurs here
84 LL |
85 LL |         drop(x);
86    |              - move occurs due to use in closure
87 ...
88 LL |     borrow(&*p);
89    |            --- borrow later used here
90
91 error[E0382]: use of moved value: `x`
92   --> $DIR/borrowck-multiple-captures.rs:52:14
93    |
94 LL |         drop(x);
95    |              - value moved here
96 LL |         drop(x);
97    |              ^ value used here after move
98    |
99    = note: move occurs because `x` has type `Box<i32>`, which does not implement the `Copy` trait
100
101 error[E0382]: use of moved value: `x`
102   --> $DIR/borrowck-multiple-captures.rs:49:19
103    |
104 LL |     let x: Box<_> = Box::new(1);
105    |         - move occurs because `x` has type `Box<i32>`, which does not implement the `Copy` trait
106 LL |     drop(x);
107    |          - value moved here
108 LL |     thread::spawn(move|| {
109    |                   ^^^^^^ value used here after move
110 LL |
111 LL |         drop(x);
112    |              - use occurs due to use in closure
113    |
114 help: consider cloning the value if the performance cost is acceptable
115    |
116 LL |     drop(x.clone());
117    |           ++++++++
118
119 error: aborting due to 8 previous errors
120
121 Some errors have detailed explanations: E0382, E0505.
122 For more information about an error, try `rustc --explain E0382`.