]> git.lizzy.rs Git - rust.git/blob - src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr
Rollup merge of #59823 - davidtwco:issue-54716, r=cramertj
[rust.git] / src / test / ui / borrowck / borrowck-vec-pattern-nesting.stderr
1 error[E0506]: cannot assign to `vec[_]` because it is borrowed
2   --> $DIR/borrowck-vec-pattern-nesting.rs:10:13
3    |
4 LL |         [box ref _a, _, _] => {
5    |              ------ borrow of `vec[_]` occurs here
6 LL |
7 LL |             vec[0] = box 4;
8    |             ^^^^^^ assignment to borrowed `vec[_]` occurs here
9 LL |
10 LL |             _a.use_ref();
11    |             -- borrow later used here
12
13 error[E0506]: cannot assign to `vec[_]` because it is borrowed
14   --> $DIR/borrowck-vec-pattern-nesting.rs:24:13
15    |
16 LL |         &mut [ref _b..] => {
17    |               ------ borrow of `vec[_]` occurs here
18 LL |
19 LL |             vec[0] = box 4;
20    |             ^^^^^^ assignment to borrowed `vec[_]` occurs here
21 LL |
22 LL |             _b.use_ref();
23    |             -- borrow later used here
24
25 error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice
26   --> $DIR/borrowck-vec-pattern-nesting.rs:35:11
27    |
28 LL |     match vec {
29    |           ^^^ cannot move out of here
30 ...
31 LL |         &mut [_a,
32    |               -- data moved here
33    |
34 note: move occurs because `_a` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
35   --> $DIR/borrowck-vec-pattern-nesting.rs:38:15
36    |
37 LL |         &mut [_a,
38    |               ^^
39 help: consider removing the `&mut`
40    |
41 LL |         [_a,
42 LL |
43 LL |
44 LL |
45 LL |             ..
46 LL |         ] => {
47    |
48
49 error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice
50   --> $DIR/borrowck-vec-pattern-nesting.rs:47:13
51    |
52 LL |     let a = vec[0];
53    |             ^^^^^^
54    |             |
55    |             cannot move out of here
56    |             help: consider borrowing here: `&vec[0]`
57
58 error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice
59   --> $DIR/borrowck-vec-pattern-nesting.rs:55:11
60    |
61 LL |     match vec {
62    |           ^^^ cannot move out of here
63 ...
64 LL |          _b] => {}
65    |          -- data moved here
66    |
67 note: move occurs because `_b` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
68   --> $DIR/borrowck-vec-pattern-nesting.rs:60:10
69    |
70 LL |          _b] => {}
71    |          ^^
72 help: consider removing the `&mut`
73    |
74 LL |         [
75 LL |
76 LL |          _b] => {}
77    |
78
79 error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice
80   --> $DIR/borrowck-vec-pattern-nesting.rs:65:13
81    |
82 LL |     let a = vec[0];
83    |             ^^^^^^
84    |             |
85    |             cannot move out of here
86    |             help: consider borrowing here: `&vec[0]`
87
88 error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice
89   --> $DIR/borrowck-vec-pattern-nesting.rs:73:11
90    |
91 LL |     match vec {
92    |           ^^^ cannot move out of here
93 ...
94 LL |         &mut [_a, _b, _c] => {}
95    |         -----------------
96    |         |     |   |   |
97    |         |     |   |   ...and here
98    |         |     |   ...and here
99    |         |     data moved here
100    |         help: consider removing the `&mut`: `[_a, _b, _c]`
101    |
102 note: move occurs because these variables have types that don't implement the `Copy` trait
103   --> $DIR/borrowck-vec-pattern-nesting.rs:76:15
104    |
105 LL |         &mut [_a, _b, _c] => {}
106    |               ^^  ^^  ^^
107
108 error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice
109   --> $DIR/borrowck-vec-pattern-nesting.rs:84:13
110    |
111 LL |     let a = vec[0];
112    |             ^^^^^^
113    |             |
114    |             cannot move out of here
115    |             help: consider borrowing here: `&vec[0]`
116
117 error: aborting due to 8 previous errors
118
119 Some errors have detailed explanations: E0506, E0508.
120 For more information about an error, try `rustc --explain E0506`.