2020-10-16 19:37:54 -03:00
|
|
|
warning: the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes
|
|
|
|
--> $DIR/double-move.rs:1:12
|
|
|
|
|
|
|
|
|
LL | #![feature(unsized_locals, unsized_fn_params)]
|
|
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= note: see issue #48055 <https://github.com/rust-lang/rust/issues/48055> for more information
|
2022-09-18 19:55:36 +04:00
|
|
|
= note: `#[warn(incomplete_features)]` on by default
|
2020-10-16 19:37:54 -03:00
|
|
|
|
2018-10-27 17:17:24 +09:00
|
|
|
error[E0382]: use of moved value: `y`
|
2020-10-16 19:37:54 -03:00
|
|
|
--> $DIR/double-move.rs:21:22
|
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
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | drop_unsized(y);
|
2018-10-27 17:17:24 +09:00
|
|
|
| ^ value used here after move
|
2022-11-02 21:22:24 -07:00
|
|
|
|
|
2022-11-11 16:57:01 -08:00
|
|
|
note: consider changing this parameter type in function `drop_unsized` to borrow instead if owning the value isn't necessary
|
2022-11-02 21:22:24 -07:00
|
|
|
--> $DIR/double-move.rs:14:31
|
|
|
|
|
|
|
|
|
LL | fn drop_unsized<T: ?Sized>(_: T) {}
|
2022-11-03 14:10:08 -07:00
|
|
|
| ------------ ^ this parameter takes ownership of the value
|
2022-11-02 21:22:24 -07:00
|
|
|
| |
|
|
|
|
| in this function
|
2018-10-27 17:17:24 +09:00
|
|
|
|
|
|
|
error[E0382]: use of moved value: `x`
|
2020-10-16 19:37:54 -03:00
|
|
|
--> $DIR/double-move.rs:27:22
|
2018-10-27 17:17:24 +09:00
|
|
|
|
|
|
|
|
LL | let _y = *x;
|
2019-04-22 08:40:08 +01:00
|
|
|
| -- value moved here
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | drop_unsized(x);
|
2020-08-08 13:16:43 -04:00
|
|
|
| ^ value used here after move
|
2018-10-27 17:17:24 +09:00
|
|
|
|
|
|
|
|
= note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait
|
|
|
|
|
|
|
|
error[E0382]: use of moved value: `*x`
|
2020-10-16 19:37:54 -03:00
|
|
|
--> $DIR/double-move.rs:33:18
|
2018-10-27 17:17:24 +09:00
|
|
|
|
|
2019-04-22 08:40:08 +01:00
|
|
|
LL | let x = "hello".to_owned().into_boxed_str();
|
2020-09-02 10:40:56 +03:00
|
|
|
| - move occurs because `x` has type `Box<str>`, which does not implement the `Copy` trait
|
2018-10-27 17:17:24 +09:00
|
|
|
LL | drop_unsized(x);
|
|
|
|
| - value moved here
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | let _y = *x;
|
2019-04-22 08:40:08 +01:00
|
|
|
| ^^ value used here after move
|
2018-10-27 17:17:24 +09:00
|
|
|
|
|
|
|
error[E0382]: use of moved value: `y`
|
2020-10-16 19:37:54 -03:00
|
|
|
--> $DIR/double-move.rs:40:9
|
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 13:48:46 -04:00
|
|
|
| ----- `y` moved due to this method call
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | y.foo();
|
2018-10-27 17:17:24 +09:00
|
|
|
| ^ value used here after move
|
2020-06-11 13:48:46 -04:00
|
|
|
|
|
2022-12-12 12:07:09 +00:00
|
|
|
note: `Foo::foo` takes ownership of the receiver `self`, which moves `y`
|
2020-10-16 19:37:54 -03:00
|
|
|
--> $DIR/double-move.rs:5:12
|
2020-06-11 13:48:46 -04:00
|
|
|
|
|
|
|
|
LL | fn foo(self) -> String;
|
|
|
|
| ^^^^
|
2018-10-27 17:17:24 +09:00
|
|
|
|
2020-04-17 09:27:35 -03:00
|
|
|
error[E0382]: use of moved value: `x`
|
2020-10-16 19:37:54 -03:00
|
|
|
--> $DIR/double-move.rs:46:9
|
2018-10-27 17:17:24 +09:00
|
|
|
|
|
|
|
|
LL | let _y = *x;
|
2019-04-22 08:40:08 +01:00
|
|
|
| -- value moved here
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | x.foo();
|
2020-08-08 13:16:43 -04:00
|
|
|
| ^ value used here after move
|
2018-10-27 17:17:24 +09:00
|
|
|
|
|
|
|
|
= note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait
|
|
|
|
|
|
|
|
error[E0382]: use of moved value: `*x`
|
2020-10-16 19:37:54 -03:00
|
|
|
--> $DIR/double-move.rs:52:18
|
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();
|
2020-09-02 10:40:56 +03:00
|
|
|
| - move occurs because `x` has type `Box<str>`, which does not implement the `Copy` trait
|
2018-10-27 17:17:24 +09:00
|
|
|
LL | x.foo();
|
|
|
|
| - value moved here
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | let _y = *x;
|
2019-04-22 08:40:08 +01:00
|
|
|
| ^^ value used here after move
|
2018-10-27 17:17:24 +09:00
|
|
|
|
2020-10-16 19:37:54 -03:00
|
|
|
error: aborting due to 6 previous errors; 1 warning emitted
|
2018-10-27 17:17:24 +09:00
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0382`.
|