2019-04-22 07:40:08 +00:00
|
|
|
error[E0382]: borrow of moved value: `x`
|
|
|
|
--> $DIR/borrow-after-move.rs:20:24
|
2018-10-27 08:17:24 +00:00
|
|
|
|
|
|
|
|
LL | let y = *x;
|
2019-04-22 07:40:08 +00:00
|
|
|
| -- value moved here
|
2018-10-27 08:17:24 +00:00
|
|
|
LL | drop_unsized(y);
|
|
|
|
LL | println!("{}", &x);
|
2020-08-08 17:16:43 +00:00
|
|
|
| ^^ value borrowed here after move
|
2018-10-27 08:17:24 +00:00
|
|
|
|
|
|
|
|
= note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait
|
|
|
|
|
2019-04-22 07:40:08 +00:00
|
|
|
error[E0382]: borrow of moved value: `y`
|
|
|
|
--> $DIR/borrow-after-move.rs:22:24
|
2018-10-27 08:17:24 +00:00
|
|
|
|
|
2019-04-22 07:40:08 +00:00
|
|
|
LL | let y = *x;
|
|
|
|
| - move occurs because `y` has type `str`, which does not implement the `Copy` trait
|
2018-10-27 08:17:24 +00:00
|
|
|
LL | drop_unsized(y);
|
|
|
|
| - value moved here
|
|
|
|
...
|
|
|
|
LL | println!("{}", &y);
|
2019-04-22 07:40:08 +00:00
|
|
|
| ^^ value borrowed here after move
|
2018-10-27 08:17:24 +00:00
|
|
|
|
2019-04-22 07:40:08 +00:00
|
|
|
error[E0382]: borrow of moved value: `x`
|
|
|
|
--> $DIR/borrow-after-move.rs:30:24
|
2018-10-27 08:17:24 +00:00
|
|
|
|
|
|
|
|
LL | let y = *x;
|
2019-04-22 07:40:08 +00:00
|
|
|
| -- value moved here
|
2018-10-27 08:17:24 +00:00
|
|
|
LL | y.foo();
|
|
|
|
LL | println!("{}", &x);
|
2020-08-08 17:16:43 +00:00
|
|
|
| ^^ value borrowed here after move
|
2018-10-27 08:17:24 +00:00
|
|
|
|
|
|
|
|
= note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait
|
|
|
|
|
2019-04-22 07:40:08 +00:00
|
|
|
error[E0382]: borrow of moved value: `y`
|
|
|
|
--> $DIR/borrow-after-move.rs:32:24
|
2018-10-27 08:17:24 +00:00
|
|
|
|
|
2019-04-22 07:40:08 +00:00
|
|
|
LL | let y = *x;
|
|
|
|
| - move occurs because `y` has type `str`, which does not implement the `Copy` trait
|
2018-10-27 08:17:24 +00:00
|
|
|
LL | y.foo();
|
2020-06-11 17:48:46 +00:00
|
|
|
| ----- `y` moved due to this method call
|
2018-10-27 08:17:24 +00:00
|
|
|
...
|
|
|
|
LL | println!("{}", &y);
|
2019-04-22 07:40:08 +00:00
|
|
|
| ^^ value borrowed here after move
|
2020-06-11 17:48:46 +00: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 08:17:24 +00:00
|
|
|
|
2019-04-22 07:40:08 +00:00
|
|
|
error[E0382]: borrow of moved value: `x`
|
|
|
|
--> $DIR/borrow-after-move.rs:39:24
|
2018-10-27 08:17:24 +00:00
|
|
|
|
|
2020-04-17 12:27:35 +00: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 08:17:24 +00:00
|
|
|
LL | x.foo();
|
|
|
|
| - value moved here
|
|
|
|
LL | println!("{}", &x);
|
2020-04-17 12:27:35 +00:00
|
|
|
| ^^ value borrowed here after move
|
2018-10-27 08:17:24 +00:00
|
|
|
|
|
|
|
error: aborting due to 5 previous errors
|
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0382`.
|