fork/rust

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

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

master
1.3 KiB35 linesraw
1error[E0507]: cannot move out of `self.b`, as `self` is a captured variable in an `Fn` closure
2  --> $DIR/issue-103624.rs:16:13
3   |
4LL |     async fn foo(&self) {
5   |                  ----- captured outer variable
6LL |         let bar = self.b.bar().await;
7LL |         spawn_blocking(move || {
8   |                        ------- captured by this `Fn` closure
9LL |
10LL |             self.b;
11   |             ^^^^^^ move occurs because `self.b` has type `StructB`, which does not implement the `Copy` trait
12
13error[E0521]: borrowed data escapes outside of method
14  --> $DIR/issue-103624.rs:14:9
15   |
16LL |       async fn foo(&self) {
17   |                    -----
18   |                    |
19   |                    `self` is a reference that is only valid in the method body
20   |                    let's call the lifetime of this reference `'1`
21LL |           let bar = self.b.bar().await;
22LL | /         spawn_blocking(move || {
23LL | |
24LL | |             self.b;
25LL | |
26LL | |         })
27   | |          ^
28   | |          |
29   | |__________`self` escapes the method body here
30   |            argument requires that `'1` must outlive `'static`
31
32error: aborting due to 2 previous errors
33
34Some errors have detailed explanations: E0507, E0521.
35For more information about an error, try `rustc --explain E0507`.