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