File: borrowck-multiple-captures.stderr

package info (click to toggle)
rustc 1.85.0%2Bdfsg3-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, sid, trixie
  • size: 893,396 kB
  • sloc: xml: 158,127; python: 35,830; javascript: 19,497; cpp: 19,002; sh: 17,245; ansic: 13,127; asm: 4,376; makefile: 1,051; perl: 29; lisp: 29; ruby: 19; sql: 11
file content (143 lines) | stat: -rw-r--r-- 4,523 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
error[E0505]: cannot move out of `x1` because it is borrowed
  --> $DIR/borrowck-multiple-captures.rs:12:19
   |
LL |     let x1: Box<_> = Box::new(1);
   |         -- binding `x1` declared here
LL |     let p1 = &x1;
   |              --- borrow of `x1` occurs here
...
LL |     thread::spawn(move|| {
   |                   ^^^^^^ move out of `x1` occurs here
...
LL |         drop(x1);
   |              -- move occurs due to use in closure
...
LL |     borrow(&*p1);
   |            ---- borrow later used here
   |
help: consider cloning the value if the performance cost is acceptable
   |
LL |     let p1 = &x1.clone();
   |                 ++++++++

error[E0505]: cannot move out of `x2` because it is borrowed
  --> $DIR/borrowck-multiple-captures.rs:12:19
   |
LL |     let x2: Box<_> = Box::new(2);
   |         -- binding `x2` declared here
LL |     let p2 = &x2;
   |              --- borrow of `x2` occurs here
LL |     thread::spawn(move|| {
   |                   ^^^^^^ move out of `x2` occurs here
...
LL |         drop(x2);
   |              -- move occurs due to use in closure
...
LL |     borrow(&*p2);
   |            ---- borrow later used here
   |
help: consider cloning the value if the performance cost is acceptable
   |
LL |     let p2 = &x2.clone();
   |                 ++++++++

error[E0382]: use of moved value: `x1`
  --> $DIR/borrowck-multiple-captures.rs:27:19
   |
LL |     let x1: Box<_> = Box::new(1);
   |         -- move occurs because `x1` has type `Box<i32>`, which does not implement the `Copy` trait
LL |     drop(x1);
   |          -- value moved here
...
LL |     thread::spawn(move|| {
   |                   ^^^^^^ value used here after move
...
LL |         drop(x1);
   |              -- use occurs due to use in closure
   |
help: consider cloning the value if the performance cost is acceptable
   |
LL |     drop(x1.clone());
   |            ++++++++

error[E0382]: use of moved value: `x2`
  --> $DIR/borrowck-multiple-captures.rs:27:19
   |
LL |     let x2: Box<_> = Box::new(2);
   |         -- move occurs because `x2` has type `Box<i32>`, which does not implement the `Copy` trait
LL |     drop(x2);
   |          -- value moved here
LL |     thread::spawn(move|| {
   |                   ^^^^^^ value used here after move
...
LL |         drop(x2);
   |              -- use occurs due to use in closure
   |
help: consider cloning the value if the performance cost is acceptable
   |
LL |     drop(x2.clone());
   |            ++++++++

error[E0382]: use of moved value: `x`
  --> $DIR/borrowck-multiple-captures.rs:41:14
   |
LL |         drop(x);
   |              - value moved here
LL |         drop(x);
   |              ^ value used here after move
   |
   = note: move occurs because `x` has type `Box<i32>`, which does not implement the `Copy` trait

error[E0505]: cannot move out of `x` because it is borrowed
  --> $DIR/borrowck-multiple-captures.rs:38:19
   |
LL |     let x: Box<_> = Box::new(1);
   |         - binding `x` declared here
LL |     let p = &x;
   |             -- borrow of `x` occurs here
LL |     thread::spawn(move|| {
   |                   ^^^^^^ move out of `x` occurs here
LL |
LL |         drop(x);
   |              - move occurs due to use in closure
...
LL |     borrow(&*p);
   |            --- borrow later used here
   |
help: consider cloning the value if the performance cost is acceptable
   |
LL |     let p = &x.clone();
   |               ++++++++

error[E0382]: use of moved value: `x`
  --> $DIR/borrowck-multiple-captures.rs:52:14
   |
LL |         drop(x);
   |              - value moved here
LL |         drop(x);
   |              ^ value used here after move
   |
   = note: move occurs because `x` has type `Box<i32>`, which does not implement the `Copy` trait

error[E0382]: use of moved value: `x`
  --> $DIR/borrowck-multiple-captures.rs:49:19
   |
LL |     let x: Box<_> = Box::new(1);
   |         - move occurs because `x` has type `Box<i32>`, which does not implement the `Copy` trait
LL |     drop(x);
   |          - value moved here
LL |     thread::spawn(move|| {
   |                   ^^^^^^ value used here after move
LL |
LL |         drop(x);
   |              - use occurs due to use in closure
   |
help: consider cloning the value if the performance cost is acceptable
   |
LL |     drop(x.clone());
   |           ++++++++

error: aborting due to 8 previous errors

Some errors have detailed explanations: E0382, E0505.
For more information about an error, try `rustc --explain E0382`.