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