]> git.lizzy.rs Git - rust.git/blob - src/test/ui/binop/binop-move-semantics.stderr
Rollup merge of #59928 - petrochenkov:denyambass, r=varkor
[rust.git] / src / test / ui / binop / binop-move-semantics.stderr
1 error[E0382]: use of moved value: `x`
2   --> $DIR/binop-move-semantics.rs:8:5
3    |
4 LL | fn double_move<T: Add<Output=()>>(x: T) {
5    |                -                  - move occurs because `x` has type `T`, which does not implement the `Copy` trait
6    |                |
7    |                consider adding a `Copy` constraint to this type argument
8 LL |     x
9    |     - value moved here
10 LL |     +
11 LL |     x;
12    |     ^ value used here after move
13
14 error[E0382]: borrow of moved value: `x`
15   --> $DIR/binop-move-semantics.rs:14:5
16    |
17 LL | fn move_then_borrow<T: Add<Output=()> + Clone>(x: T) {
18    |                     -                          - move occurs because `x` has type `T`, which does not implement the `Copy` trait
19    |                     |
20    |                     consider adding a `Copy` constraint to this type argument
21 LL |     x
22    |     - value moved here
23 LL |     +
24 LL |     x.clone();
25    |     ^ value borrowed here after move
26
27 error[E0505]: cannot move out of `x` because it is borrowed
28   --> $DIR/binop-move-semantics.rs:21:5
29    |
30 LL |     let m = &x;
31    |             -- borrow of `x` occurs here
32 ...
33 LL |     x
34    |     ^ move out of `x` occurs here
35 ...
36 LL |     use_mut(n); use_imm(m);
37    |                         - borrow later used here
38
39 error[E0505]: cannot move out of `y` because it is borrowed
40   --> $DIR/binop-move-semantics.rs:23:5
41    |
42 LL |     let n = &mut y;
43    |             ------ borrow of `y` occurs here
44 ...
45 LL |     y;
46    |     ^ move out of `y` occurs here
47 LL |     use_mut(n); use_imm(m);
48    |             - borrow later used here
49
50 error[E0507]: cannot move out of borrowed content
51   --> $DIR/binop-move-semantics.rs:30:5
52    |
53 LL |     *m
54    |     ^^ cannot move out of borrowed content
55
56 error[E0507]: cannot move out of borrowed content
57   --> $DIR/binop-move-semantics.rs:32:5
58    |
59 LL |     *n;
60    |     ^^ cannot move out of borrowed content
61
62 error[E0502]: cannot borrow `f` as immutable because it is also borrowed as mutable
63   --> $DIR/binop-move-semantics.rs:54:5
64    |
65 LL |       &mut f
66    |       ------
67    |       |
68    |  _____mutable borrow occurs here
69    | |
70 LL | |     +
71 LL | |     &f;
72    | |     ^-
73    | |_____||
74    |       |mutable borrow later used here
75    |       immutable borrow occurs here
76
77 error[E0502]: cannot borrow `f` as mutable because it is also borrowed as immutable
78   --> $DIR/binop-move-semantics.rs:62:5
79    |
80 LL |       &f
81    |       --
82    |       |
83    |  _____immutable borrow occurs here
84    | |
85 LL | |     +
86 LL | |     &mut f;
87    | |     ^^^^^-
88    | |_____|____|
89    |       |    immutable borrow later used here
90    |       mutable borrow occurs here
91
92 error: aborting due to 8 previous errors
93
94 Some errors have detailed explanations: E0382, E0502, E0505, E0507.
95 For more information about an error, try `rustc --explain E0382`.