File: issue-105084.stderr

package info (click to toggle)
rustc 1.87.0%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 925,564 kB
  • sloc: xml: 158,127; python: 36,039; javascript: 19,761; sh: 19,737; cpp: 18,981; ansic: 13,133; asm: 4,376; makefile: 710; perl: 29; lisp: 28; ruby: 19; sql: 11
file content (51 lines) | stat: -rw-r--r-- 2,099 bytes parent folder | download | duplicates (12)
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
45
46
47
48
49
50
51
error[E0382]: borrow of moved value: `g`
  --> $DIR/issue-105084.rs:38:14
   |
LL |     let mut g = #[coroutine]
   |         ----- move occurs because `g` has type `{coroutine@$DIR/issue-105084.rs:16:5: 16:7}`, which does not implement the `Copy` trait
...
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
  --> $DIR/issue-105084.rs:10:21
   |
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());
   |                       ++++++++

error[E0277]: the trait bound `Box<(i32, ())>: Copy` is not satisfied in `{coroutine@$DIR/issue-105084.rs:16:5: 16:7}`
  --> $DIR/issue-105084.rs:32:17
   |
LL |     || {
   |     -- within this `{coroutine@$DIR/issue-105084.rs:16:5: 16:7}`
...
LL |     let mut h = copy(g);
   |                 ^^^^^^^ within `{coroutine@$DIR/issue-105084.rs:16:5: 16:7}`, the trait `Copy` is not implemented for `Box<(i32, ())>`
   |
note: coroutine does not implement `Copy` as this value is used across a yield
  --> $DIR/issue-105084.rs:22:41
   |
LL |         let t = std::boxed::box_new((5, yield));
   |                 ------------------------^^^^^--
   |                 |                       |
   |                 |                       yield occurs here, with `std::boxed::box_new((5, yield))` maybe used later
   |                 has type `Box<(i32, ())>` which does not implement `Copy`
note: required by a bound in `copy`
  --> $DIR/issue-105084.rs:10:12
   |
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`.