blob: dfae6cc75d9c6e53d6c8239b61c26fe3cf2e7ba8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
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
= 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
LL | drop_unsized(y);
| ^ value used here after move
error[E0382]: use of moved value: `x`
--> $DIR/double-move.rs:27:22
|
LL | let _y = *x;
| -- value moved here
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
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
LL | y.foo();
| ^ value used here after move
|
note: this function 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
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
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`.
|