]>
Commit | Line | Data |
---|---|---|
9ffffee4 | 1 | error[E0382]: borrow of moved value: `g` |
353b0b11 | 2 | --> $DIR/issue-105084.rs:45:14 |
9ffffee4 FG |
3 | | |
4 | LL | let mut g = || { | |
5 | | ----- move occurs because `g` has type `[generator@$DIR/issue-105084.rs:22:17: 22:19]`, which does not implement the `Copy` trait | |
6 | ... | |
7 | LL | let mut h = copy(g); | |
8 | | - value moved here | |
9 | ... | |
10 | LL | Pin::new(&mut g).resume(()); | |
11 | | ^^^^^^ value borrowed here after move | |
12 | | | |
13 | note: consider changing this parameter type in function `copy` to borrow instead if owning the value isn't necessary | |
14 | --> $DIR/issue-105084.rs:17:21 | |
15 | | | |
16 | LL | fn copy<T: Copy>(x: T) -> T { | |
17 | | ---- ^ this parameter takes ownership of the value | |
18 | | | | |
19 | | in this function | |
20 | help: consider cloning the value if the performance cost is acceptable | |
21 | | | |
22 | LL | let mut h = copy(g.clone()); | |
23 | | ++++++++ | |
24 | ||
25 | error[E0277]: the trait bound `Box<(i32, ())>: Copy` is not satisfied in `[generator@$DIR/issue-105084.rs:22:17: 22:19]` | |
353b0b11 | 26 | --> $DIR/issue-105084.rs:39:17 |
9ffffee4 FG |
27 | | |
28 | LL | let mut g = || { | |
29 | | -- within this `[generator@$DIR/issue-105084.rs:22:17: 22:19]` | |
30 | ... | |
31 | LL | let mut h = copy(g); | |
32 | | ^^^^ within `[generator@$DIR/issue-105084.rs:22:17: 22:19]`, the trait `Copy` is not implemented for `Box<(i32, ())>` | |
33 | | | |
34 | note: generator does not implement `Copy` as this value is used across a yield | |
353b0b11 | 35 | --> $DIR/issue-105084.rs:29:22 |
9ffffee4 | 36 | | |
353b0b11 FG |
37 | LL | Box::new((5, yield)); |
38 | | -------------^^^^^-- | |
39 | | | | | |
40 | | | yield occurs here, with `Box::new((5, yield))` maybe used later | |
41 | | has type `Box<(i32, ())>` which does not implement `Copy` | |
9ffffee4 FG |
42 | note: required by a bound in `copy` |
43 | --> $DIR/issue-105084.rs:17:12 | |
44 | | | |
45 | LL | fn copy<T: Copy>(x: T) -> T { | |
46 | | ^^^^ required by this bound in `copy` | |
47 | ||
48 | error: aborting due to 2 previous errors | |
49 | ||
50 | Some errors have detailed explanations: E0277, E0382. | |
51 | For more information about an error, try `rustc --explain E0277`. |