]> git.lizzy.rs Git - rust.git/blob - tests/ui/moves/moves-based-on-type-distribute-copy-over-paren.stderr
Rollup merge of #106446 - bzEq:fix-unwind-lsda, r=Amanieu
[rust.git] / tests / ui / moves / moves-based-on-type-distribute-copy-over-paren.stderr
1 error[E0382]: borrow of moved value: `x`
2   --> $DIR/moves-based-on-type-distribute-copy-over-paren.rs:12:11
3    |
4 LL |     let x = "hi".to_string();
5    |         - move occurs because `x` has type `String`, which does not implement the `Copy` trait
6 LL |
7 LL |     let _y = Foo { f:x };
8    |                      - value moved here
9 LL |
10 LL |     touch(&x);
11    |           ^^ value borrowed here after move
12    |
13 help: consider cloning the value if the performance cost is acceptable
14    |
15 LL |     let _y = Foo { f:x.clone() };
16    |                       ++++++++
17
18 error[E0382]: borrow of moved value: `x`
19   --> $DIR/moves-based-on-type-distribute-copy-over-paren.rs:21:11
20    |
21 LL |     let x = "hi".to_string();
22    |         - move occurs because `x` has type `String`, which does not implement the `Copy` trait
23 LL |
24 LL |     let _y = Foo { f:(((x))) };
25    |                      ------- value moved here
26 LL |
27 LL |     touch(&x);
28    |           ^^ value borrowed here after move
29    |
30 help: consider cloning the value if the performance cost is acceptable
31    |
32 LL |     let _y = Foo { f:(((x))).clone() };
33    |                             ++++++++
34
35 error: aborting due to 2 previous errors
36
37 For more information about this error, try `rustc --explain E0382`.