fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1error[E0382]: use of moved value: `x` 2 --> $DIR/binop-move-semantics.rs:8:5 3 | 4LL | fn double_move<T: Add<Output=()>>(x: T) { 5 | - move occurs because `x` has type `T`, which does not implement the `Copy` trait 6LL | / x 7LL | | + 8LL | | x; 9 | | ^ 10 | | | 11 | |_____value used here after move 12 | `x` moved due to usage in operator 13 | 14note: calling this operator moves the left-hand side 15 --> $SRC_DIR/core/src/ops/arith.rs:LL:COL 16help: consider further restricting this bound 17 | 18LL | fn double_move<T: Add<Output=()> + Copy>(x: T) { 19 | ++++++ 20 21error[E0382]: borrow of moved value: `x` 22 --> $DIR/binop-move-semantics.rs:14:5 23 | 24LL | fn move_then_borrow<T: Add<Output=()> + Clone>(x: T) { 25 | - move occurs because `x` has type `T`, which does not implement the `Copy` trait 26LL | x 27 | - value moved here 28LL | + 29LL | x.clone(); 30 | ^ value borrowed here after move 31 | 32help: consider cloning the value if the performance cost is acceptable 33 | 34LL | x.clone() 35 | ++++++++ 36help: consider further restricting this bound 37 | 38LL | fn move_then_borrow<T: Add<Output=()> + Clone + Copy>(x: T) { 39 | ++++++ 40 41error[E0505]: cannot move out of `x` because it is borrowed 42 --> $DIR/binop-move-semantics.rs:21:5 43 | 44LL | fn move_borrowed<T: Add<Output=()>>(x: T, mut y: T) { 45 | - binding `x` declared here 46LL | let m = &x; 47 | -- borrow of `x` occurs here 48... 49LL | x 50 | ^ move out of `x` occurs here 51... 52LL | use_mut(n); use_imm(m); 53 | - borrow later used here 54 55error[E0505]: cannot move out of `y` because it is borrowed 56 --> $DIR/binop-move-semantics.rs:23:5 57 | 58LL | fn move_borrowed<T: Add<Output=()>>(x: T, mut y: T) { 59 | ----- binding `y` declared here 60LL | let m = &x; 61LL | let n = &mut y; 62 | ------ borrow of `y` occurs here 63... 64LL | y; 65 | ^ move out of `y` occurs here 66LL | use_mut(n); use_imm(m); 67 | - borrow later used here 68 69error[E0507]: cannot move out of `*m` which is behind a mutable reference 70 --> $DIR/binop-move-semantics.rs:30:5 71 | 72LL | *m 73 | -^ 74 | | 75 | _____move occurs because `*m` has type `T`, which does not implement the `Copy` trait 76 | | 77LL | | + 78LL | | *n; 79 | |______- `*m` moved due to usage in operator 80 | 81note: calling this operator moves the left-hand side 82 --> $SRC_DIR/core/src/ops/arith.rs:LL:COL 83 84error[E0507]: cannot move out of `*n` which is behind a shared reference 85 --> $DIR/binop-move-semantics.rs:32:5 86 | 87LL | *n; 88 | ^^ move occurs because `*n` has type `T`, which does not implement the `Copy` trait 89 90error[E0502]: cannot borrow `f` as immutable because it is also borrowed as mutable 91 --> $DIR/binop-move-semantics.rs:54:5 92 | 93LL | &mut f 94 | ------ 95 | | 96 | _____mutable borrow occurs here 97 | | 98LL | | + 99LL | | &f; 100 | | ^- 101 | |_____|| 102 | |mutable borrow later used here 103 | immutable borrow occurs here 104 105error[E0502]: cannot borrow `f` as mutable because it is also borrowed as immutable 106 --> $DIR/binop-move-semantics.rs:62:5 107 | 108LL | &f 109 | -- 110 | | 111 | _____immutable borrow occurs here 112 | | 113LL | | + 114LL | | &mut f; 115 | | ^^^^^- 116 | |_____|____| 117 | | immutable borrow later used here 118 | mutable borrow occurs here 119 120error: aborting due to 8 previous errors 121 122Some errors have detailed explanations: E0382, E0502, E0505, E0507. 123For more information about an error, try `rustc --explain E0382`.