]> git.lizzy.rs Git - rust.git/blob - tests/ui/unsized-locals/double-move.stderr
Auto merge of #107843 - bjorn3:sync_cg_clif-2023-02-09, r=bjorn3
[rust.git] / tests / ui / unsized-locals / double-move.stderr
1 warning: 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    |
4 LL | #![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
10 error[E0382]: use of moved value: `y`
11   --> $DIR/double-move.rs:21:22
12    |
13 LL |         let y = *x;
14    |             - move occurs because `y` has type `str`, which does not implement the `Copy` trait
15 LL |         drop_unsized(y);
16    |                      - value moved here
17 LL |         drop_unsized(y);
18    |                      ^ value used here after move
19    |
20 note: 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    |
23 LL | fn drop_unsized<T: ?Sized>(_: T) {}
24    |    ------------               ^ this parameter takes ownership of the value
25    |    |
26    |    in this function
27
28 error[E0382]: use of moved value: `x`
29   --> $DIR/double-move.rs:27:22
30    |
31 LL |         let _y = *x;
32    |                  -- value moved here
33 LL |         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
38 error[E0382]: use of moved value: `*x`
39   --> $DIR/double-move.rs:33:18
40    |
41 LL |         let x = "hello".to_owned().into_boxed_str();
42    |             - move occurs because `x` has type `Box<str>`, which does not implement the `Copy` trait
43 LL |         drop_unsized(x);
44    |                      - value moved here
45 LL |         let _y = *x;
46    |                  ^^ value used here after move
47
48 error[E0382]: use of moved value: `y`
49   --> $DIR/double-move.rs:40:9
50    |
51 LL |         let y = *x;
52    |             - move occurs because `y` has type `str`, which does not implement the `Copy` trait
53 LL |         y.foo();
54    |           ----- `y` moved due to this method call
55 LL |         y.foo();
56    |         ^ value used here after move
57    |
58 note: `Foo::foo` takes ownership of the receiver `self`, which moves `y`
59   --> $DIR/double-move.rs:5:12
60    |
61 LL |     fn foo(self) -> String;
62    |            ^^^^
63
64 error[E0382]: use of moved value: `x`
65   --> $DIR/double-move.rs:46:9
66    |
67 LL |         let _y = *x;
68    |                  -- value moved here
69 LL |         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
74 error[E0382]: use of moved value: `*x`
75   --> $DIR/double-move.rs:52:18
76    |
77 LL |         let x = "hello".to_owned().into_boxed_str();
78    |             - move occurs because `x` has type `Box<str>`, which does not implement the `Copy` trait
79 LL |         x.foo();
80    |         - value moved here
81 LL |         let _y = *x;
82    |                  ^^ value used here after move
83
84 error: aborting due to 6 previous errors; 1 warning emitted
85
86 For more information about this error, try `rustc --explain E0382`.