fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #71365 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum4fb7144ed15

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