fork/rust

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

borsAuto merge of #66089 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum4560ea788cb

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