error[E0507]: cannot move out of `*x` which is behind a shared reference --> $DIR/move-out-of-ref.rs:9:9 | LL | fn hello(x: &Ty) { | --- move occurs because `*x` has type `Ty`, which does not implement the `Copy` trait LL | let c = async || { LL | *x; | ^^ `*x` is moved here | note: if `Ty` implemented `Clone`, you could clone the value --> $DIR/move-out-of-ref.rs:5:1 | LL | struct Ty; | ^^^^^^^^^ consider implementing `Clone` for this type ... LL | *x; | -- you could clone this value error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0507`.