2017-12-10 22:47:55 +03:00
|
|
|
error[E0506]: cannot assign to `vec[..]` because it is borrowed
|
|
|
|
--> $DIR/borrowck-vec-pattern-nesting.rs:21:13
|
|
|
|
|
|
2018-02-23 03:42:32 +03:00
|
|
|
LL | [box ref _a, _, _] => {
|
2017-12-10 22:47:55 +03:00
|
|
|
| ------ borrow of `vec[..]` occurs here
|
2018-02-25 02:01:39 +03:00
|
|
|
LL | //~^ borrow of `vec[..]` occurs here
|
2018-02-23 03:42:32 +03:00
|
|
|
LL | vec[0] = box 4; //~ ERROR cannot assign
|
2017-12-10 22:47:55 +03:00
|
|
|
| ^^^^^^^^^^^^^^ assignment to borrowed `vec[..]` occurs here
|
|
|
|
|
|
|
|
error[E0506]: cannot assign to `vec[..]` because it is borrowed
|
|
|
|
--> $DIR/borrowck-vec-pattern-nesting.rs:33:13
|
|
|
|
|
|
2018-02-23 03:42:32 +03:00
|
|
|
LL | &mut [ref _b..] => {
|
2017-12-10 22:47:55 +03:00
|
|
|
| ------ borrow of `vec[..]` occurs here
|
2018-02-25 02:01:39 +03:00
|
|
|
LL | //~^ borrow of `vec[..]` occurs here
|
2018-02-23 03:42:32 +03:00
|
|
|
LL | vec[0] = box 4; //~ ERROR cannot assign
|
2017-12-10 22:47:55 +03:00
|
|
|
| ^^^^^^^^^^^^^^ assignment to borrowed `vec[..]` occurs here
|
|
|
|
|
|
|
|
error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice
|
|
|
|
--> $DIR/borrowck-vec-pattern-nesting.rs:43:14
|
|
|
|
|
|
2018-02-23 03:42:32 +03:00
|
|
|
LL | &mut [_a, //~ ERROR cannot move out
|
2017-12-10 22:47:55 +03:00
|
|
|
| ^-- hint: to prevent move, use `ref _a` or `ref mut _a`
|
|
|
|
| ______________|
|
|
|
|
| |
|
2018-02-23 03:42:32 +03:00
|
|
|
LL | | //~| cannot move out
|
|
|
|
LL | | //~| to prevent move
|
|
|
|
LL | | ..
|
|
|
|
LL | | ] => {
|
2017-12-10 22:47:55 +03:00
|
|
|
| |_________^ cannot move out of here
|
|
|
|
|
|
|
|
error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice
|
|
|
|
--> $DIR/borrowck-vec-pattern-nesting.rs:56:13
|
|
|
|
|
|
2018-02-23 03:42:32 +03:00
|
|
|
LL | let a = vec[0]; //~ ERROR cannot move out
|
2017-12-10 22:47:55 +03:00
|
|
|
| ^^^^^^
|
|
|
|
| |
|
|
|
|
| cannot move out of here
|
|
|
|
| help: consider using a reference instead: `&vec[0]`
|
|
|
|
|
|
|
|
error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice
|
|
|
|
--> $DIR/borrowck-vec-pattern-nesting.rs:64:14
|
|
|
|
|
|
2018-02-23 03:42:32 +03:00
|
|
|
LL | &mut [ //~ ERROR cannot move out
|
2017-12-10 22:47:55 +03:00
|
|
|
| ______________^
|
2018-02-23 03:42:32 +03:00
|
|
|
LL | | //~^ cannot move out
|
|
|
|
LL | | _b] => {}
|
2017-12-10 22:47:55 +03:00
|
|
|
| |__________--^ cannot move out of here
|
|
|
|
| |
|
|
|
|
| hint: to prevent move, use `ref _b` or `ref mut _b`
|
|
|
|
|
|
|
|
error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice
|
|
|
|
--> $DIR/borrowck-vec-pattern-nesting.rs:69:13
|
|
|
|
|
|
2018-02-23 03:42:32 +03:00
|
|
|
LL | let a = vec[0]; //~ ERROR cannot move out
|
2017-12-10 22:47:55 +03:00
|
|
|
| ^^^^^^
|
|
|
|
| |
|
|
|
|
| cannot move out of here
|
|
|
|
| help: consider using a reference instead: `&vec[0]`
|
|
|
|
|
|
|
|
error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice
|
|
|
|
--> $DIR/borrowck-vec-pattern-nesting.rs:77:14
|
|
|
|
|
|
2018-02-23 03:42:32 +03:00
|
|
|
LL | &mut [_a, _b, _c] => {} //~ ERROR cannot move out
|
2017-12-10 22:47:55 +03:00
|
|
|
| ^--^^--^^--^
|
|
|
|
| || | |
|
|
|
|
| || | ...and here (use `ref _c` or `ref mut _c`)
|
|
|
|
| || ...and here (use `ref _b` or `ref mut _b`)
|
|
|
|
| |hint: to prevent move, use `ref _a` or `ref mut _a`
|
|
|
|
| cannot move out of here
|
|
|
|
|
|
|
|
error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice
|
2017-12-10 23:29:24 +03:00
|
|
|
--> $DIR/borrowck-vec-pattern-nesting.rs:81:13
|
2017-12-10 22:47:55 +03:00
|
|
|
|
|
2018-02-23 03:42:32 +03:00
|
|
|
LL | let a = vec[0]; //~ ERROR cannot move out
|
2017-12-10 22:47:55 +03:00
|
|
|
| ^^^^^^
|
|
|
|
| |
|
|
|
|
| cannot move out of here
|
|
|
|
| help: consider using a reference instead: `&vec[0]`
|
|
|
|
|
|
|
|
error: aborting due to 8 previous errors
|
|
|
|
|
2018-02-19 21:40:25 +01:00
|
|
|
You've got a few errors: E0506, E0508
|
|
|
|
If you want more information on an error, try using "rustc --explain E0506"
|