File: issue-103624.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 (44 lines) | stat: -rw-r--r-- 1,581 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
error[E0507]: cannot move out of `self.b`, as `self` is a captured variable in an `Fn` closure
  --> $DIR/issue-103624.rs:16:13
   |
LL |     async fn foo(&self) {
   |                  ----- captured outer variable
LL |         let bar = self.b.bar().await;
LL |         spawn_blocking(move || {
   |                        ------- captured by this `Fn` closure
LL |
LL |             self.b;
   |             ^^^^^^ move occurs because `self.b` has type `StructB`, which does not implement the `Copy` trait
   |
note: if `StructB` implemented `Clone`, you could clone the value
  --> $DIR/issue-103624.rs:23:1
   |
LL |             self.b;
   |             ------ you could clone this value
...
LL | struct StructB {}
   | ^^^^^^^^^^^^^^ consider implementing `Clone` for this type

error[E0521]: borrowed data escapes outside of method
  --> $DIR/issue-103624.rs:14:9
   |
LL |       async fn foo(&self) {
   |                    -----
   |                    |
   |                    `self` is a reference that is only valid in the method body
   |                    let's call the lifetime of this reference `'1`
LL |           let bar = self.b.bar().await;
LL | /         spawn_blocking(move || {
LL | |
LL | |             self.b;
LL | |
LL | |         })
   | |          ^
   | |          |
   | |__________`self` escapes the method body here
   |            argument requires that `'1` must outlive `'static`

error: aborting due to 2 previous errors

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