]> git.lizzy.rs Git - rust.git/blob - src/test/ui/unsized-locals/borrow-after-move.stderr
Suggest `mem::forget` if `mem::ManuallyDrop::new` isn't used
[rust.git] / src / test / ui / unsized-locals / borrow-after-move.stderr
1 error[E0382]: borrow of moved value: `x`
2   --> $DIR/borrow-after-move.rs:20:24
3    |
4 LL |         let y = *x;
5    |                 -- value moved here
6 LL |         drop_unsized(y);
7 LL |         println!("{}", &x);
8    |                        ^^ value borrowed here after partial move
9    |
10    = note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait
11
12 error[E0382]: borrow of moved value: `y`
13   --> $DIR/borrow-after-move.rs:22:24
14    |
15 LL |         let y = *x;
16    |             - move occurs because `y` has type `str`, which does not implement the `Copy` trait
17 LL |         drop_unsized(y);
18    |                      - value moved here
19 ...
20 LL |         println!("{}", &y);
21    |                        ^^ value borrowed here after move
22
23 error[E0382]: borrow of moved value: `x`
24   --> $DIR/borrow-after-move.rs:30:24
25    |
26 LL |         let y = *x;
27    |                 -- value moved here
28 LL |         y.foo();
29 LL |         println!("{}", &x);
30    |                        ^^ value borrowed here after partial move
31    |
32    = note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait
33
34 error[E0382]: borrow of moved value: `y`
35   --> $DIR/borrow-after-move.rs:32:24
36    |
37 LL |         let y = *x;
38    |             - move occurs because `y` has type `str`, which does not implement the `Copy` trait
39 LL |         y.foo();
40    |           ----- `y` moved due to this method call
41 ...
42 LL |         println!("{}", &y);
43    |                        ^^ value borrowed here after move
44    |
45 note: this function consumes the receiver `self` by taking ownership of it, which moves `y`
46   --> $DIR/borrow-after-move.rs:4:12
47    |
48 LL |     fn foo(self) -> String;
49    |            ^^^^
50
51 error[E0382]: borrow of moved value: `x`
52   --> $DIR/borrow-after-move.rs:39:24
53    |
54 LL |         let x = "hello".to_owned().into_boxed_str();
55    |             - move occurs because `x` has type `std::boxed::Box<str>`, which does not implement the `Copy` trait
56 LL |         x.foo();
57    |         - value moved here
58 LL |         println!("{}", &x);
59    |                        ^^ value borrowed here after move
60
61 error: aborting due to 5 previous errors
62
63 For more information about this error, try `rustc --explain E0382`.