rust/tests/ui/unsized-locals/double-move.stderr

87 lines
3.0 KiB
Plaintext
Raw Normal View History

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
error[E0382]: use of moved value: `y`
--> $DIR/double-move.rs:21:22
|
LL | let y = *x;
| - move occurs because `y` has type `str`, which does not implement the `Copy` trait
LL | drop_unsized(y);
| - value moved here
2019-03-09 06:03:44 -06:00
LL | drop_unsized(y);
| ^ value used here after move
|
note: consider changing this parameter type in function `drop_unsized` to borrow instead if owning the value isn't necessary
--> $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
| |
| in this function
error[E0382]: use of moved value: `x`
--> $DIR/double-move.rs:27:22
|
LL | let _y = *x;
| -- value moved here
2019-03-09 06:03:44 -06:00
LL | drop_unsized(x);
| ^ value used here after move
|
= note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait
error[E0382]: use of moved value: `*x`
--> $DIR/double-move.rs:33:18
|
LL | let x = "hello".to_owned().into_boxed_str();
| - move occurs because `x` has type `Box<str>`, which does not implement the `Copy` trait
LL | drop_unsized(x);
| - value moved here
2019-03-09 06:03:44 -06:00
LL | let _y = *x;
| ^^ value used here after move
error[E0382]: use of moved value: `y`
--> $DIR/double-move.rs:40:9
|
LL | let y = *x;
| - move occurs because `y` has type `str`, which does not implement the `Copy` trait
LL | y.foo();
| ----- `y` moved due to this method call
2019-03-09 06:03:44 -06:00
LL | y.foo();
| ^ value used here after move
|
2022-12-12 06:07:09 -06:00
note: `Foo::foo` takes ownership of the receiver `self`, which moves `y`
--> $DIR/double-move.rs:5:12
|
LL | fn foo(self) -> String;
| ^^^^
error[E0382]: use of moved value: `x`
--> $DIR/double-move.rs:46:9
|
LL | let _y = *x;
| -- value moved here
2019-03-09 06:03:44 -06:00
LL | x.foo();
| ^ value used here after move
|
= note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait
error[E0382]: use of moved value: `*x`
--> $DIR/double-move.rs:52:18
|
LL | let x = "hello".to_owned().into_boxed_str();
| - move occurs because `x` has type `Box<str>`, which does not implement the `Copy` trait
LL | x.foo();
| - value moved here
2019-03-09 06:03:44 -06:00
LL | let _y = *x;
| ^^ value used here after move
error: aborting due to 6 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0382`.