2019-04-22 08:40:08 +01:00
|
|
|
error[E0382]: borrow of moved value: `x`
|
|
|
|
--> $DIR/borrow-after-move.rs:20:24
|
2018-10-27 17:17:24 +09:00
|
|
|
|
|
|
|
|
LL | let y = *x;
|
2019-04-22 08:40:08 +01:00
|
|
|
| -- value moved here
|
2018-10-27 17:17:24 +09:00
|
|
|
LL | drop_unsized(y);
|
|
|
|
LL | println!("{}", &x);
|
2019-04-22 08:40:08 +01:00
|
|
|
| ^^ value borrowed here after partial move
|
2018-10-27 17:17:24 +09:00
|
|
|
|
|
|
|
|
= note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait
|
|
|
|
|
2019-04-22 08:40:08 +01:00
|
|
|
error[E0382]: borrow of moved value: `y`
|
|
|
|
--> $DIR/borrow-after-move.rs:22:24
|
2018-10-27 17:17:24 +09:00
|
|
|
|
|
2019-04-22 08:40:08 +01:00
|
|
|
LL | let y = *x;
|
|
|
|
| - move occurs because `y` has type `str`, which does not implement the `Copy` trait
|
2018-10-27 17:17:24 +09:00
|
|
|
LL | drop_unsized(y);
|
|
|
|
| - value moved here
|
|
|
|
...
|
|
|
|
LL | println!("{}", &y);
|
2019-04-22 08:40:08 +01:00
|
|
|
| ^^ value borrowed here after move
|
2018-10-27 17:17:24 +09:00
|
|
|
|
2019-04-22 08:40:08 +01:00
|
|
|
error[E0382]: borrow of moved value: `x`
|
|
|
|
--> $DIR/borrow-after-move.rs:30:24
|
2018-10-27 17:17:24 +09:00
|
|
|
|
|
|
|
|
LL | let y = *x;
|
2019-04-22 08:40:08 +01:00
|
|
|
| -- value moved here
|
2018-10-27 17:17:24 +09:00
|
|
|
LL | y.foo();
|
|
|
|
LL | println!("{}", &x);
|
2019-04-22 08:40:08 +01:00
|
|
|
| ^^ value borrowed here after partial move
|
2018-10-27 17:17:24 +09:00
|
|
|
|
|
|
|
|
= note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait
|
|
|
|
|
2019-04-22 08:40:08 +01:00
|
|
|
error[E0382]: borrow of moved value: `y`
|
|
|
|
--> $DIR/borrow-after-move.rs:32:24
|
2018-10-27 17:17:24 +09:00
|
|
|
|
|
2019-04-22 08:40:08 +01:00
|
|
|
LL | let y = *x;
|
|
|
|
| - move occurs because `y` has type `str`, which does not implement the `Copy` trait
|
2018-10-27 17:17:24 +09:00
|
|
|
LL | y.foo();
|
2020-06-11 18:10:13 -04:00
|
|
|
| ----- `y` moved due to this method call
|
2018-10-27 17:17:24 +09:00
|
|
|
...
|
|
|
|
LL | println!("{}", &y);
|
2019-04-22 08:40:08 +01:00
|
|
|
| ^^ value borrowed here after move
|
2020-06-11 13:48:46 -04:00
|
|
|
|
|
|
|
|
note: this function consumes the receiver `self` by taking ownership of it, which moves `y`
|
|
|
|
--> $DIR/borrow-after-move.rs:4:12
|
|
|
|
|
|
|
|
|
LL | fn foo(self) -> String;
|
|
|
|
| ^^^^
|
2018-10-27 17:17:24 +09:00
|
|
|
|
2019-04-22 08:40:08 +01:00
|
|
|
error[E0382]: borrow of moved value: `x`
|
|
|
|
--> $DIR/borrow-after-move.rs:39:24
|
2018-10-27 17:17:24 +09:00
|
|
|
|
|
2020-04-17 09:27:35 -03:00
|
|
|
LL | let x = "hello".to_owned().into_boxed_str();
|
|
|
|
| - move occurs because `x` has type `std::boxed::Box<str>`, which does not implement the `Copy` trait
|
2018-10-27 17:17:24 +09:00
|
|
|
LL | x.foo();
|
|
|
|
| - value moved here
|
|
|
|
LL | println!("{}", &x);
|
2020-04-17 09:27:35 -03:00
|
|
|
| ^^ value borrowed here after move
|
2018-10-27 17:17:24 +09:00
|
|
|
|
|
|
|
error: aborting due to 5 previous errors
|
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0382`.
|