blob: d718ee29cf9b5241050b0061537bcf8dbb7c4575 [file] [log] [blame]
error[E0505]: cannot move out of `arr[..]` because it is borrowed
--> $DIR/borrowck-move-ref-pattern.rs:10:24
|
LL | let hold_all = &arr;
| ---- borrow of `arr` occurs here
LL | let [ref _x0_hold, _x1, ref xs_hold @ ..] = arr;
| ^^^ move out of `arr[..]` occurs here
LL | _x1 = U;
LL | drop(hold_all);
| -------- borrow later used here
error[E0384]: cannot assign twice to immutable variable `_x1`
--> $DIR/borrowck-move-ref-pattern.rs:11:5
|
LL | let [ref _x0_hold, _x1, ref xs_hold @ ..] = arr;
| ---
| |
| first assignment to `_x1`
| help: make this binding mutable: `mut _x1`
LL | _x1 = U;
| ^^^^^^^ cannot assign twice to immutable variable
error[E0505]: cannot move out of `arr[..]` because it is borrowed
--> $DIR/borrowck-move-ref-pattern.rs:13:10
|
LL | let [ref _x0_hold, _x1, ref xs_hold @ ..] = arr;
| ------------ borrow of `arr[..]` occurs here
...
LL | let [_x0, ..] = arr;
| ^^^ move out of `arr[..]` occurs here
LL | drop(_x0_hold);
| -------- borrow later used here
error[E0502]: cannot borrow `arr[..]` as mutable because it is also borrowed as immutable
--> $DIR/borrowck-move-ref-pattern.rs:15:16
|
LL | let [ref _x0_hold, _x1, ref xs_hold @ ..] = arr;
| ---------------- immutable borrow occurs here
...
LL | let [_, _, ref mut _x2, _x3, mut _x4] = arr;
| ^^^^^^^^^^^ mutable borrow occurs here
...
LL | drop(xs_hold);
| ------- immutable borrow later used here
error[E0505]: cannot move out of `arr[..]` because it is borrowed
--> $DIR/borrowck-move-ref-pattern.rs:15:29
|
LL | let [ref _x0_hold, _x1, ref xs_hold @ ..] = arr;
| ---------------- borrow of `arr[..]` occurs here
...
LL | let [_, _, ref mut _x2, _x3, mut _x4] = arr;
| ^^^ move out of `arr[..]` occurs here
...
LL | drop(xs_hold);
| ------- borrow later used here
error[E0505]: cannot move out of `arr[..]` because it is borrowed
--> $DIR/borrowck-move-ref-pattern.rs:15:34
|
LL | let [ref _x0_hold, _x1, ref xs_hold @ ..] = arr;
| ---------------- borrow of `arr[..]` occurs here
...
LL | let [_, _, ref mut _x2, _x3, mut _x4] = arr;
| ^^^^^^^ move out of `arr[..]` occurs here
...
LL | drop(xs_hold);
| ------- borrow later used here
error[E0384]: cannot assign twice to immutable variable `_x1`
--> $DIR/borrowck-move-ref-pattern.rs:25:5
|
LL | let (ref _x0, _x1, ref _x2, ..) = tup;
| ---
| |
| first assignment to `_x1`
| help: make this binding mutable: `mut _x1`
LL | _x1 = U;
| ^^^^^^^ cannot assign twice to immutable variable
error[E0502]: cannot borrow `tup.0` as mutable because it is also borrowed as immutable
--> $DIR/borrowck-move-ref-pattern.rs:26:20
|
LL | let (ref _x0, _x1, ref _x2, ..) = tup;
| ------- immutable borrow occurs here
LL | _x1 = U;
LL | let _x0_hold = &mut tup.0;
| ^^^^^^^^^^ mutable borrow occurs here
LL | let (ref mut _x0_hold, ..) = tup;
LL | *_x0 = U;
| -------- immutable borrow later used here
error[E0502]: cannot borrow `tup.0` as mutable because it is also borrowed as immutable
--> $DIR/borrowck-move-ref-pattern.rs:27:10
|
LL | let (ref _x0, _x1, ref _x2, ..) = tup;
| ------- immutable borrow occurs here
...
LL | let (ref mut _x0_hold, ..) = tup;
| ^^^^^^^^^^^^^^^^ mutable borrow occurs here
LL | *_x0 = U;
| -------- immutable borrow later used here
error[E0594]: cannot assign to `*_x0` which is behind a `&` reference
--> $DIR/borrowck-move-ref-pattern.rs:28:5
|
LL | let (ref _x0, _x1, ref _x2, ..) = tup;
| ------- help: consider changing this to be a mutable reference: `ref mut _x0`
...
LL | *_x0 = U;
| ^^^^^^^^ `_x0` is a `&` reference, so the data it refers to cannot be written
error[E0594]: cannot assign to `*_x2` which is behind a `&` reference
--> $DIR/borrowck-move-ref-pattern.rs:29:5
|
LL | let (ref _x0, _x1, ref _x2, ..) = tup;
| ------- help: consider changing this to be a mutable reference: `ref mut _x2`
...
LL | *_x2 = U;
| ^^^^^^^^ `_x2` is a `&` reference, so the data it refers to cannot be written
error[E0382]: use of moved value: `tup.1`
--> $DIR/borrowck-move-ref-pattern.rs:30:10
|
LL | let (ref _x0, _x1, ref _x2, ..) = tup;
| --- value moved here
...
LL | drop(tup.1);
| ^^^^^ value used here after move
|
= note: move occurs because `tup.1` has type `U`, which does not implement the `Copy` trait
error[E0382]: borrow of moved value: `tup.1`
--> $DIR/borrowck-move-ref-pattern.rs:31:20
|
LL | drop(tup.1);
| ----- value moved here
LL | let _x1_hold = &tup.1;
| ^^^^^^ value borrowed here after move
|
= note: move occurs because `tup.1` has type `U`, which does not implement the `Copy` trait
error[E0502]: cannot borrow `tup.3` as immutable because it is also borrowed as mutable
--> $DIR/borrowck-move-ref-pattern.rs:33:20
|
LL | let (.., ref mut _x3) = tup;
| ----------- mutable borrow occurs here
LL | let _x3_hold = &tup.3;
| ^^^^^^ immutable borrow occurs here
...
LL | drop(_x3);
| --- mutable borrow later used here
error[E0499]: cannot borrow `tup.3` as mutable more than once at a time
--> $DIR/borrowck-move-ref-pattern.rs:34:20
|
LL | let (.., ref mut _x3) = tup;
| ----------- first mutable borrow occurs here
LL | let _x3_hold = &tup.3;
LL | let _x3_hold = &mut tup.3;
| ^^^^^^^^^^ second mutable borrow occurs here
...
LL | drop(_x3);
| --- first borrow later used here
error[E0499]: cannot borrow `tup.3` as mutable more than once at a time
--> $DIR/borrowck-move-ref-pattern.rs:35:14
|
LL | let (.., ref mut _x3) = tup;
| ----------- first mutable borrow occurs here
...
LL | let (.., ref mut _x4_hold) = tup;
| ^^^^^^^^^^^^^^^^ second mutable borrow occurs here
LL | let (.., ref _x4_hold) = tup;
LL | drop(_x3);
| --- first borrow later used here
error[E0502]: cannot borrow `tup.3` as immutable because it is also borrowed as mutable
--> $DIR/borrowck-move-ref-pattern.rs:36:14
|
LL | let (.., ref mut _x3) = tup;
| ----------- mutable borrow occurs here
...
LL | let (.., ref _x4_hold) = tup;
| ^^^^^^^^^^^^ immutable borrow occurs here
LL | drop(_x3);
| --- mutable borrow later used here
error[E0382]: use of moved value: `tup`
--> $DIR/borrowck-move-ref-pattern.rs:45:14
|
LL | let mut tup = (U, U, U);
| ------- move occurs because `tup` has type `(U, U, U)`, which does not implement the `Copy` trait
LL | let c1 = || {
| -- value moved into closure here
LL | let (ref _x0, _x1, _) = tup;
| --- variable moved due to use in closure
LL | };
LL | let c2 = || {
| ^^ value used here after move
LL |
LL | let (ref mut _x0, _, _x2) = tup;
| --- use occurs due to use in closure
error: aborting due to 18 previous errors
Some errors have detailed explanations: E0382, E0384, E0499, E0502, E0505, E0594.
For more information about an error, try `rustc --explain E0382`.