2023-01-21 04:03:12 -06:00
error[E0382]: borrow of moved value: `g`
2023-06-24 05:02:54 -05:00
--> $DIR/issue-105084.rs:37:14
2023-01-21 04:03:12 -06:00
|
LL | let mut g = || {
2023-10-19 16:46:28 -05:00
| ----- move occurs because `g` has type `{coroutine@$DIR/issue-105084.rs:14:17: 14:19}`, which does not implement the `Copy` trait
2023-01-21 04:03:12 -06:00
...
LL | let mut h = copy(g);
| - value moved here
...
LL | Pin::new(&mut g).resume(());
| ^^^^^^ value borrowed here after move
|
note: consider changing this parameter type in function `copy` to borrow instead if owning the value isn't necessary
2023-06-24 05:02:54 -05:00
--> $DIR/issue-105084.rs:9:21
2023-01-21 04:03:12 -06:00
|
LL | fn copy<T: Copy>(x: T) -> T {
| ---- ^ this parameter takes ownership of the value
| |
| in this function
help: consider cloning the value if the performance cost is acceptable
|
LL | let mut h = copy(g.clone());
| ++++++++
2023-10-19 16:46:28 -05:00
error[E0277]: the trait bound `Box<(i32, ())>: Copy` is not satisfied in `{coroutine@$DIR/issue-105084.rs:14:17: 14:19}`
2023-06-24 05:02:54 -05:00
--> $DIR/issue-105084.rs:31:17
2023-01-21 04:03:12 -06:00
|
LL | let mut g = || {
2023-10-19 16:46:28 -05:00
| -- within this `{coroutine@$DIR/issue-105084.rs:14:17: 14:19}`
2023-01-21 04:03:12 -06:00
...
LL | let mut h = copy(g);
2024-01-29 12:31:02 -06:00
| ^^^^^^^ within `{coroutine@$DIR/issue-105084.rs:14:17: 14:19}`, the trait `Copy` is not implemented for `Box<(i32, ())>`, which is required by `{coroutine@$DIR/issue-105084.rs:14:17: 14:19}: Copy`
2023-01-21 04:03:12 -06:00
|
2023-10-19 16:46:28 -05:00
note: coroutine does not implement `Copy` as this value is used across a yield
2023-06-24 05:02:54 -05:00
--> $DIR/issue-105084.rs:21:22
2023-01-21 04:03:12 -06:00
|
2023-02-27 07:07:44 -06:00
LL | Box::new((5, yield));
| -------------^^^^^--
| | |
| | yield occurs here, with `Box::new((5, yield))` maybe used later
| has type `Box<(i32, ())>` which does not implement `Copy`
2023-01-21 04:03:12 -06:00
note: required by a bound in `copy`
2023-06-24 05:02:54 -05:00
--> $DIR/issue-105084.rs:9:12
2023-01-21 04:03:12 -06:00
|
LL | fn copy<T: Copy>(x: T) -> T {
| ^^^^ required by this bound in `copy`
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0277, E0382.
For more information about an error, try `rustc --explain E0277`.