fork/rust

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

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

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