fork/rust

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

borsAuto merge of #69444 - pietroalbini:stable-next-final-v2-new, r=pietroalbinif3e1a954d2e

1.41.1
4.1 KiB86 linesraw
1error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
2  --> $DIR/borrowck-slice-pattern-element-loan-array.rs:8:13
3   |
4LL |     let [ref first, ref second, ..] = *s;
5   |                     ---------- immutable borrow occurs here
6LL |     let [_, ref mut  second2, ref mut third, ..] = *s;
7   |             ^^^^^^^^^^^^^^^^ mutable borrow occurs here
8LL |     nop(&[first, second, second2, third]);
9   |                  ------ immutable borrow later used here
10
11error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
12  --> $DIR/borrowck-slice-pattern-element-loan-array.rs:14:14
13   |
14LL |     let [.., ref fourth, ref third, _, ref first] = *s;
15   |                          --------- immutable borrow occurs here
16LL |     let [.., ref mut third2, _, _] = *s;
17   |              ^^^^^^^^^^^^^^ mutable borrow occurs here
18LL |     nop(&[first, third, third2, fourth]);
19   |                  ----- immutable borrow later used here
20
21error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
22  --> $DIR/borrowck-slice-pattern-element-loan-array.rs:21:16
23   |
24LL |     let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s;
25   |                 ------------- immutable borrow occurs here
26LL | 
27LL |     let [_, _, ref mut from_begin2, ..] = *s;
28   |                ^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
29LL |     nop(&[from_begin2, from_end1, from_end3, from_end4]);
30   |                                              --------- immutable borrow later used here
31
32error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
33  --> $DIR/borrowck-slice-pattern-element-loan-array.rs:23:19
34   |
35LL |     let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s;
36   |                                ------------- immutable borrow occurs here
37...
38LL |     let [_, _, _, ref mut from_begin3, ..] = *s;
39   |                   ^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
40LL |     nop(&[from_begin3, from_end1, from_end3, from_end4]);
41   |                                   --------- immutable borrow later used here
42
43error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
44  --> $DIR/borrowck-slice-pattern-element-loan-array.rs:28:14
45   |
46LL |     let [ref from_begin0, ref from_begin1, _, ref from_begin3, _, ..] = *s;
47   |                                               --------------- immutable borrow occurs here
48LL | 
49LL |     let [.., ref mut from_end3, _,  _] = *s;
50   |              ^^^^^^^^^^^^^^^^^ mutable borrow occurs here
51LL |     nop(&[from_begin0, from_begin1, from_begin3, from_end3]);
52   |                                     ----------- immutable borrow later used here
53
54error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
55  --> $DIR/borrowck-slice-pattern-element-loan-array.rs:34:13
56   |
57LL |     let [ref first, ref second, ..] = *s;
58   |                     ---------- immutable borrow occurs here
59LL |     let [_, ref mut tail @ ..] = *s;
60   |             ^^^^^^^^^^^^^^^^^ mutable borrow occurs here
61LL |     nop(&[first, second]);
62   |                  ------ immutable borrow later used here
63
64error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
65  --> $DIR/borrowck-slice-pattern-element-loan-array.rs:41:10
66   |
67LL |     let [.., ref second, ref first] = *s;
68   |              ---------- immutable borrow occurs here
69LL |     let [ref mut tail @ .., _] = *s;
70   |          ^^^^^^^^^^^^^^^^^ mutable borrow occurs here
71LL |     nop(&[first, second]);
72   |                  ------ immutable borrow later used here
73
74error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
75  --> $DIR/borrowck-slice-pattern-element-loan-array.rs:48:10
76   |
77LL |     let [_,  ref s1 @ ..] = *s;
78   |              ----------- immutable borrow occurs here
79LL |     let [ref mut s2 @ .., _, _] = *s;
80   |          ^^^^^^^^^^^^^^^ mutable borrow occurs here
81LL |     nop_subslice(s1);
82   |                  -- immutable borrow later used here
83
84error: aborting due to 8 previous errors
85
86For more information about this error, try `rustc --explain E0502`.