fork/rust
git clone https://git.julia.blue/fork/rust
49cae55760d
1.44.0
1error[E0505]: cannot move out of `arr[..]` because it is borrowed 2 --> $DIR/borrowck-move-ref-pattern.rs:10:24 3 | 4LL | let hold_all = &arr; 5 | ---- borrow of `arr` occurs here 6LL | let [ref _x0_hold, _x1, ref xs_hold @ ..] = arr; 7 | ^^^ move out of `arr[..]` occurs here 8LL | _x1 = U; 9LL | drop(hold_all); 10 | -------- borrow later used here 11 12error[E0384]: cannot assign twice to immutable variable `_x1` 13 --> $DIR/borrowck-move-ref-pattern.rs:11:5 14 | 15LL | let [ref _x0_hold, _x1, ref xs_hold @ ..] = arr; 16 | --- 17 | | 18 | first assignment to `_x1` 19 | help: make this binding mutable: `mut _x1` 20LL | _x1 = U; 21 | ^^^^^^^ cannot assign twice to immutable variable 22 23error[E0505]: cannot move out of `arr[..]` because it is borrowed 24 --> $DIR/borrowck-move-ref-pattern.rs:13:10 25 | 26LL | let [ref _x0_hold, _x1, ref xs_hold @ ..] = arr; 27 | ------------ borrow of `arr[..]` occurs here 28... 29LL | let [_x0, ..] = arr; 30 | ^^^ move out of `arr[..]` occurs here 31LL | drop(_x0_hold); 32 | -------- borrow later used here 33 34error[E0502]: cannot borrow `arr[..]` as mutable because it is also borrowed as immutable 35 --> $DIR/borrowck-move-ref-pattern.rs:15:16 36 | 37LL | let [ref _x0_hold, _x1, ref xs_hold @ ..] = arr; 38 | ---------------- immutable borrow occurs here 39... 40LL | let [_, _, ref mut _x2, _x3, mut _x4] = arr; 41 | ^^^^^^^^^^^ mutable borrow occurs here 42... 43LL | drop(xs_hold); 44 | ------- immutable borrow later used here 45 46error[E0505]: cannot move out of `arr[..]` because it is borrowed 47 --> $DIR/borrowck-move-ref-pattern.rs:15:29 48 | 49LL | let [ref _x0_hold, _x1, ref xs_hold @ ..] = arr; 50 | ---------------- borrow of `arr[..]` occurs here 51... 52LL | let [_, _, ref mut _x2, _x3, mut _x4] = arr; 53 | ^^^ move out of `arr[..]` occurs here 54... 55LL | drop(xs_hold); 56 | ------- borrow later used here 57 58error[E0505]: cannot move out of `arr[..]` because it is borrowed 59 --> $DIR/borrowck-move-ref-pattern.rs:15:34 60 | 61LL | let [ref _x0_hold, _x1, ref xs_hold @ ..] = arr; 62 | ---------------- borrow of `arr[..]` occurs here 63... 64LL | let [_, _, ref mut _x2, _x3, mut _x4] = arr; 65 | ^^^^^^^ move out of `arr[..]` occurs here 66... 67LL | drop(xs_hold); 68 | ------- borrow later used here 69 70error[E0384]: cannot assign twice to immutable variable `_x1` 71 --> $DIR/borrowck-move-ref-pattern.rs:25:5 72 | 73LL | let (ref _x0, _x1, ref _x2, ..) = tup; 74 | --- 75 | | 76 | first assignment to `_x1` 77 | help: make this binding mutable: `mut _x1` 78LL | _x1 = U; 79 | ^^^^^^^ cannot assign twice to immutable variable 80 81error[E0502]: cannot borrow `tup.0` as mutable because it is also borrowed as immutable 82 --> $DIR/borrowck-move-ref-pattern.rs:26:20 83 | 84LL | let (ref _x0, _x1, ref _x2, ..) = tup; 85 | ------- immutable borrow occurs here 86LL | _x1 = U; 87LL | let _x0_hold = &mut tup.0; 88 | ^^^^^^^^^^ mutable borrow occurs here 89LL | let (ref mut _x0_hold, ..) = tup; 90LL | *_x0 = U; 91 | -------- immutable borrow later used here 92 93error[E0502]: cannot borrow `tup.0` as mutable because it is also borrowed as immutable 94 --> $DIR/borrowck-move-ref-pattern.rs:27:10 95 | 96LL | let (ref _x0, _x1, ref _x2, ..) = tup; 97 | ------- immutable borrow occurs here 98... 99LL | let (ref mut _x0_hold, ..) = tup; 100 | ^^^^^^^^^^^^^^^^ mutable borrow occurs here 101LL | *_x0 = U; 102 | -------- immutable borrow later used here 103 104error[E0594]: cannot assign to `*_x0` which is behind a `&` reference 105 --> $DIR/borrowck-move-ref-pattern.rs:28:5 106 | 107LL | let (ref _x0, _x1, ref _x2, ..) = tup; 108 | ------- help: consider changing this to be a mutable reference: `ref mut _x0` 109... 110LL | *_x0 = U; 111 | ^^^^^^^^ `_x0` is a `&` reference, so the data it refers to cannot be written 112 113error[E0594]: cannot assign to `*_x2` which is behind a `&` reference 114 --> $DIR/borrowck-move-ref-pattern.rs:29:5 115 | 116LL | let (ref _x0, _x1, ref _x2, ..) = tup; 117 | ------- help: consider changing this to be a mutable reference: `ref mut _x2` 118... 119LL | *_x2 = U; 120 | ^^^^^^^^ `_x2` is a `&` reference, so the data it refers to cannot be written 121 122error[E0382]: use of moved value: `tup.1` 123 --> $DIR/borrowck-move-ref-pattern.rs:30:10 124 | 125LL | let (ref _x0, _x1, ref _x2, ..) = tup; 126 | --- value moved here 127... 128LL | drop(tup.1); 129 | ^^^^^ value used here after move 130 | 131 = note: move occurs because `tup.1` has type `U`, which does not implement the `Copy` trait 132 133error[E0382]: borrow of moved value: `tup.1` 134 --> $DIR/borrowck-move-ref-pattern.rs:31:20 135 | 136LL | drop(tup.1); 137 | ----- value moved here 138LL | let _x1_hold = &tup.1; 139 | ^^^^^^ value borrowed here after move 140 | 141 = note: move occurs because `tup.1` has type `U`, which does not implement the `Copy` trait 142 143error[E0502]: cannot borrow `tup.3` as immutable because it is also borrowed as mutable 144 --> $DIR/borrowck-move-ref-pattern.rs:33:20 145 | 146LL | let (.., ref mut _x3) = tup; 147 | ----------- mutable borrow occurs here 148LL | let _x3_hold = &tup.3; 149 | ^^^^^^ immutable borrow occurs here 150... 151LL | drop(_x3); 152 | --- mutable borrow later used here 153 154error[E0499]: cannot borrow `tup.3` as mutable more than once at a time 155 --> $DIR/borrowck-move-ref-pattern.rs:34:20 156 | 157LL | let (.., ref mut _x3) = tup; 158 | ----------- first mutable borrow occurs here 159LL | let _x3_hold = &tup.3; 160LL | let _x3_hold = &mut tup.3; 161 | ^^^^^^^^^^ second mutable borrow occurs here 162... 163LL | drop(_x3); 164 | --- first borrow later used here 165 166error[E0499]: cannot borrow `tup.3` as mutable more than once at a time 167 --> $DIR/borrowck-move-ref-pattern.rs:35:14 168 | 169LL | let (.., ref mut _x3) = tup; 170 | ----------- first mutable borrow occurs here 171... 172LL | let (.., ref mut _x4_hold) = tup; 173 | ^^^^^^^^^^^^^^^^ second mutable borrow occurs here 174LL | let (.., ref _x4_hold) = tup; 175LL | drop(_x3); 176 | --- first borrow later used here 177 178error[E0502]: cannot borrow `tup.3` as immutable because it is also borrowed as mutable 179 --> $DIR/borrowck-move-ref-pattern.rs:36:14 180 | 181LL | let (.., ref mut _x3) = tup; 182 | ----------- mutable borrow occurs here 183... 184LL | let (.., ref _x4_hold) = tup; 185 | ^^^^^^^^^^^^ immutable borrow occurs here 186LL | drop(_x3); 187 | --- mutable borrow later used here 188 189error[E0382]: use of moved value: `tup` 190 --> $DIR/borrowck-move-ref-pattern.rs:45:14 191 | 192LL | let mut tup = (U, U, U); 193 | ------- move occurs because `tup` has type `(U, U, U)`, which does not implement the `Copy` trait 194LL | let c1 = || { 195 | -- value moved into closure here 196LL | let (ref _x0, _x1, _) = tup; 197 | --- variable moved due to use in closure 198LL | }; 199LL | let c2 = || { 200 | ^^ value used here after move 201LL | 202LL | let (ref mut _x0, _, _x2) = tup; 203 | --- use occurs due to use in closure 204 205error: aborting due to 18 previous errors 206 207Some errors have detailed explanations: E0382, E0384, E0499, E0502, E0505, E0594. 208For more information about an error, try `rustc --explain E0382`.