fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
3.0 KiB86 linesraw
1warning: the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes
2  --> $DIR/double-move.rs:1:12
3   |
4LL | #![feature(unsized_locals, unsized_fn_params)]
5   |            ^^^^^^^^^^^^^^
6   |
7   = note: see issue #48055 <https://github.com/rust-lang/rust/issues/48055> for more information
8   = note: `#[warn(incomplete_features)]` on by default
9
10error[E0382]: use of moved value: `y`
11  --> $DIR/double-move.rs:21:22
12   |
13LL |         let y = *x;
14   |             - move occurs because `y` has type `str`, which does not implement the `Copy` trait
15LL |         drop_unsized(y);
16   |                      - value moved here
17LL |         drop_unsized(y);
18   |                      ^ value used here after move
19   |
20note: consider changing this parameter type in function `drop_unsized` to borrow instead if owning the value isn't necessary
21  --> $DIR/double-move.rs:14:31
22   |
23LL | fn drop_unsized<T: ?Sized>(_: T) {}
24   |    ------------               ^ this parameter takes ownership of the value
25   |    |
26   |    in this function
27
28error[E0382]: use of moved value: `x`
29  --> $DIR/double-move.rs:27:22
30   |
31LL |         let _y = *x;
32   |                  -- value moved here
33LL |         drop_unsized(x);
34   |                      ^ value used here after move
35   |
36   = note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait
37
38error[E0382]: use of moved value: `*x`
39  --> $DIR/double-move.rs:33:18
40   |
41LL |         let x = "hello".to_owned().into_boxed_str();
42   |             - move occurs because `x` has type `Box<str>`, which does not implement the `Copy` trait
43LL |         drop_unsized(x);
44   |                      - value moved here
45LL |         let _y = *x;
46   |                  ^^ value used here after move
47
48error[E0382]: use of moved value: `y`
49  --> $DIR/double-move.rs:40:9
50   |
51LL |         let y = *x;
52   |             - move occurs because `y` has type `str`, which does not implement the `Copy` trait
53LL |         y.foo();
54   |           ----- `y` moved due to this method call
55LL |         y.foo();
56   |         ^ value used here after move
57   |
58note: `Foo::foo` takes ownership of the receiver `self`, which moves `y`
59  --> $DIR/double-move.rs:5:12
60   |
61LL |     fn foo(self) -> String;
62   |            ^^^^
63
64error[E0382]: use of moved value: `x`
65  --> $DIR/double-move.rs:46:9
66   |
67LL |         let _y = *x;
68   |                  -- value moved here
69LL |         x.foo();
70   |         ^ value used here after move
71   |
72   = note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait
73
74error[E0382]: use of moved value: `*x`
75  --> $DIR/double-move.rs:52:18
76   |
77LL |         let x = "hello".to_owned().into_boxed_str();
78   |             - move occurs because `x` has type `Box<str>`, which does not implement the `Copy` trait
79LL |         x.foo();
80   |         - value moved here
81LL |         let _y = *x;
82   |                  ^^ value used here after move
83
84error: aborting due to 6 previous errors; 1 warning emitted
85
86For more information about this error, try `rustc --explain E0382`.