fork/rust

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

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

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