Point at the type that doesn't impl Clone in more cases beyond closures
This commit is contained in:
parent
dafc9f9b53
commit
6237e735c4
3 changed files with 12 additions and 15 deletions
|
|
@ -1,14 +1,13 @@
|
|||
error[E0507]: cannot move out of `x` which is behind a mutable reference
|
||||
--> $DIR/closure-shim-borrowck-error.rs:11:18
|
||||
|
|
||||
LL | fn hello(x: Ty) {
|
||||
| -- move occurs because `x` has type `Ty`, which does not implement the `Copy` trait
|
||||
LL | needs_fn_mut(async || {
|
||||
| ^^^^^^^^ `x` is moved here
|
||||
LL |
|
||||
LL | x.hello();
|
||||
| -
|
||||
| |
|
||||
| variable moved due to use in coroutine
|
||||
| move occurs because `x` has type `Ty`, which does not implement the `Copy` trait
|
||||
| - variable moved due to use in coroutine
|
||||
|
|
||||
note: if `Ty` implemented `Clone`, you could clone the value
|
||||
--> $DIR/closure-shim-borrowck-error.rs:17:1
|
||||
|
|
|
|||
|
|
@ -1,8 +1,11 @@
|
|||
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;
|
||||
| ^^ move occurs because `*x` has type `Ty`, which does not implement the `Copy` trait
|
||||
| ^^ `*x` is moved here
|
||||
|
|
||||
note: if `Ty` implemented `Clone`, you could clone the value
|
||||
--> $DIR/move-out-of-ref.rs:5:1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue