2024-09-04 16:03:47 -07:00
|
|
|
error[E0382]: use of moved value: `x`
|
2024-09-19 19:35:01 -07:00
|
|
|
--> $DIR/feature-gate-pin_ergonomics.rs:17:9
|
2024-09-04 16:03:47 -07:00
|
|
|
|
|
|
|
|
LL | fn bar(mut x: Pin<&mut Foo>) {
|
|
|
|
| ----- move occurs because `x` has type `Pin<&mut Foo>`, which does not implement the `Copy` trait
|
|
|
|
LL | foo(x);
|
|
|
|
| - value moved here
|
|
|
|
LL | foo(x);
|
|
|
|
| ^ value used here after move
|
|
|
|
|
|
|
|
|
note: consider changing this parameter type in function `foo` to borrow instead if owning the value isn't necessary
|
2024-09-19 19:35:01 -07:00
|
|
|
--> $DIR/feature-gate-pin_ergonomics.rs:12:11
|
2024-09-04 16:03:47 -07:00
|
|
|
|
|
|
|
|
LL | fn foo(_: Pin<&mut Foo>) {
|
|
|
|
| --- ^^^^^^^^^^^^^ this parameter takes ownership of the value
|
|
|
|
| |
|
|
|
|
| in this function
|
|
|
|
|
2024-09-19 19:35:01 -07:00
|
|
|
error[E0382]: use of moved value: `x`
|
2024-10-01 12:44:10 -07:00
|
|
|
--> $DIR/feature-gate-pin_ergonomics.rs:22:5
|
2024-09-19 19:35:01 -07:00
|
|
|
|
|
2024-10-01 12:44:10 -07:00
|
|
|
LL | fn baz(mut x: Pin<&mut Foo>) {
|
2024-09-19 19:35:01 -07:00
|
|
|
| ----- move occurs because `x` has type `Pin<&mut Foo>`, which does not implement the `Copy` trait
|
|
|
|
LL | x.foo();
|
|
|
|
| ----- `x` moved due to this method call
|
|
|
|
LL | x.foo();
|
|
|
|
| ^ value used here after move
|
|
|
|
|
|
|
|
|
note: `Foo::foo` takes ownership of the receiver `self`, which moves `x`
|
|
|
|
--> $DIR/feature-gate-pin_ergonomics.rs:8:12
|
|
|
|
|
|
|
|
|
LL | fn foo(self: Pin<&mut Self>) {
|
|
|
|
| ^^^^
|
|
|
|
help: consider reborrowing the `Pin` instead of moving it
|
|
|
|
|
|
|
|
|
LL | x.as_mut().foo();
|
|
|
|
| +++++++++
|
|
|
|
|
2024-10-01 12:44:10 -07:00
|
|
|
error: aborting due to 2 previous errors
|
2024-09-04 16:03:47 -07:00
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0382`.
|