fork/rust

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

borsAuto merge of #67350 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum73528e339aa

1.40.0
6.2 KiB119 linesraw
1error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
2  --> $DIR/borrowck-slice-pattern-element-loan.rs:18:20
3   |
4LL |     if let [ref first, ref second, ..] = *s {
5   |                        ---------- immutable borrow occurs here
6LL |         if 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.rs:34:21
13   |
14LL |     if let [.., ref fourth, ref third, _, ref first] = *s {
15   |                             --------- immutable borrow occurs here
16LL |         if 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.rs:45:20
23   |
24LL |     if let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s {
25   |                    ------------- immutable borrow occurs here
26...
27LL |         if let [_, ref mut from_begin1, ..] = *s {
28   |                    ^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
29LL |             nop(&[from_begin1, 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.rs:48:23
34   |
35LL |     if let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s {
36   |                                   ------------- immutable borrow occurs here
37...
38LL |         if let [_, _, ref mut from_begin2, ..] = *s {
39   |                       ^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
40LL |             nop(&[from_begin2, 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.rs:51:26
45   |
46LL |     if let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s {
47   |                                   ------------- immutable borrow occurs here
48...
49LL |         if let [_, _, _, ref mut from_begin3, ..] = *s {
50   |                          ^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
51LL |             nop(&[from_begin3, from_end1, from_end3, from_end4]);
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.rs:59:21
56   |
57LL |     if let [ref from_begin0, ref from_begin1, _, ref from_begin3, _, ..] = *s {
58   |                                                  --------------- immutable borrow occurs here
59...
60LL |         if let [.., ref mut from_end2, _] = *s {
61   |                     ^^^^^^^^^^^^^^^^^ mutable borrow occurs here
62LL |             nop(&[from_begin0, from_begin1, from_begin3, from_end2]);
63   |                                             ----------- immutable borrow later used here
64
65error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
66  --> $DIR/borrowck-slice-pattern-element-loan.rs:62:21
67   |
68LL |     if let [ref from_begin0, ref from_begin1, _, ref from_begin3, _, ..] = *s {
69   |                                                  --------------- immutable borrow occurs here
70...
71LL |         if let [.., ref mut from_end3, _,  _] = *s {
72   |                     ^^^^^^^^^^^^^^^^^ mutable borrow occurs here
73LL |             nop(&[from_begin0, from_begin1, from_begin3, from_end3]);
74   |                                             ----------- immutable borrow later used here
75
76error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
77  --> $DIR/borrowck-slice-pattern-element-loan.rs:65:21
78   |
79LL |     if let [ref from_begin0, ref from_begin1, _, ref from_begin3, _, ..] = *s {
80   |                              --------------- immutable borrow occurs here
81...
82LL |         if let [.., ref mut from_end4, _, _, _] = *s {
83   |                     ^^^^^^^^^^^^^^^^^ mutable borrow occurs here
84LL |             nop(&[from_begin0, from_begin1, from_begin3, from_end4]);
85   |                                ----------- immutable borrow later used here
86
87error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
88  --> $DIR/borrowck-slice-pattern-element-loan.rs:82:20
89   |
90LL |     if let [ref first, ref second, ..] = *s {
91   |                        ---------- immutable borrow occurs here
92LL |         if let [_, ref mut tail @ ..] = *s {
93   |                    ^^^^^^^^^^^^^^^^^ mutable borrow occurs here
94LL |             nop(&[first, second]);
95   |                          ------ immutable borrow later used here
96
97error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
98  --> $DIR/borrowck-slice-pattern-element-loan.rs:100:17
99   |
100LL |     if let [.., ref second, ref first] = *s {
101   |                 ---------- immutable borrow occurs here
102LL |         if let [ref mut tail @ .., _] = *s {
103   |                 ^^^^^^^^^^^^^^^^^ mutable borrow occurs here
104LL |             nop(&[first, second]);
105   |                          ------ immutable borrow later used here
106
107error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
108  --> $DIR/borrowck-slice-pattern-element-loan.rs:109:17
109   |
110LL |     if let [_, _, _, ref s1 @ ..] = *s {
111   |                      ----------- immutable borrow occurs here
112LL |         if let [ref mut s2 @ .., _, _, _] = *s {
113   |                 ^^^^^^^^^^^^^^^ mutable borrow occurs here
114LL |             nop_subslice(s1);
115   |                          -- immutable borrow later used here
116
117error: aborting due to 11 previous errors
118
119For more information about this error, try `rustc --explain E0502`.