fork/rust

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

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
3.8 KiB125 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   |              ------ `vec[_]` is borrowed here
6LL |
7LL |             vec[0] = Box::new(4);
8   |             ^^^^^^ `vec[_]` is assigned to here but it was already borrowed
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   |               ------ `vec[_]` is borrowed here
18LL |
19LL |             vec[0] = Box::new(4);
20   |             ^^^^^^ `vec[_]` is assigned to here but it was already borrowed
21LL |
22LL |             _b.use_ref();
23   |             -- borrow later used here
24
25error[E0508]: cannot move out of type `[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 `Box<isize>`, which does not implement the `Copy` trait
36   |
37help: consider removing the mutable borrow
38   |
39LL -         &mut [_a,
40LL +         [_a,
41   |
42
43error[E0508]: cannot move out of type `[Box<isize>]`, a non-copy slice
44  --> $DIR/borrowck-vec-pattern-nesting.rs:46:13
45   |
46LL |     let a = vec[0];
47   |             ^^^^^^
48   |             |
49   |             cannot move out of here
50   |             move occurs because `vec[_]` has type `Box<isize>`, which does not implement the `Copy` trait
51   |
52help: consider borrowing here
53   |
54LL |     let a = &vec[0];
55   |             +
56
57error[E0508]: cannot move out of type `[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 `Box<isize>`, which does not implement the `Copy` trait
68   |
69help: consider removing the mutable borrow
70   |
71LL -         &mut [
72LL +         [
73   |
74
75error[E0508]: cannot move out of type `[Box<isize>]`, a non-copy slice
76  --> $DIR/borrowck-vec-pattern-nesting.rs:65:13
77   |
78LL |     let a = vec[0];
79   |             ^^^^^^
80   |             |
81   |             cannot move out of here
82   |             move occurs because `vec[_]` has type `Box<isize>`, which does not implement the `Copy` trait
83   |
84help: consider borrowing here
85   |
86LL |     let a = &vec[0];
87   |             +
88
89error[E0508]: cannot move out of type `[Box<isize>]`, a non-copy slice
90  --> $DIR/borrowck-vec-pattern-nesting.rs:74:11
91   |
92LL |     match vec {
93   |           ^^^ cannot move out of here
94...
95LL |         &mut [_a, _b, _c] => {}
96   |               --  --  -- ...and here
97   |               |   |
98   |               |   ...and here
99   |               data moved here
100   |
101   = note: move occurs because these variables have types that don't implement the `Copy` trait
102help: consider removing the mutable borrow
103   |
104LL -         &mut [_a, _b, _c] => {}
105LL +         [_a, _b, _c] => {}
106   |
107
108error[E0508]: cannot move out of type `[Box<isize>]`, a non-copy slice
109  --> $DIR/borrowck-vec-pattern-nesting.rs:85:13
110   |
111LL |     let a = vec[0];
112   |             ^^^^^^
113   |             |
114   |             cannot move out of here
115   |             move occurs because `vec[_]` has type `Box<isize>`, which does not implement the `Copy` trait
116   |
117help: consider borrowing here
118   |
119LL |     let a = &vec[0];
120   |             +
121
122error: aborting due to 8 previous errors
123
124Some errors have detailed explanations: E0506, E0508.
125For more information about an error, try `rustc --explain E0506`.