]> git.lizzy.rs Git - rust.git/blob - src/test/ui/borrowck/borrowck-slice-pattern-element-loan.stderr
Rollup merge of #63055 - Mark-Simulacrum:save-analysis-clean-2, r=Xanewok
[rust.git] / src / test / ui / borrowck / borrowck-slice-pattern-element-loan.stderr
1 error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
2   --> $DIR/borrowck-slice-pattern-element-loan.rs:18:20
3    |
4 LL |     if let [ref first, ref second, ..] = *s {
5    |                        ---------- immutable borrow occurs here
6 LL |         if let [_, ref mut  second2, ref mut third, ..] = *s {
7    |                    ^^^^^^^^^^^^^^^^ mutable borrow occurs here
8 LL |             nop(&[first, second, second2, third]);
9    |                          ------ immutable borrow later used here
10
11 error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
12   --> $DIR/borrowck-slice-pattern-element-loan.rs:34:21
13    |
14 LL |     if let [.., ref fourth, ref third, _, ref first] = *s {
15    |                             --------- immutable borrow occurs here
16 LL |         if let [.., ref mut third2, _, _] = *s {
17    |                     ^^^^^^^^^^^^^^ mutable borrow occurs here
18 LL |             nop(&[first, third, third2, fourth]);
19    |                          ----- immutable borrow later used here
20
21 error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
22   --> $DIR/borrowck-slice-pattern-element-loan.rs:45:20
23    |
24 LL |     if let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s {
25    |                    ------------- immutable borrow occurs here
26 ...
27 LL |         if let [_, ref mut from_begin1, ..] = *s {
28    |                    ^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
29 LL |             nop(&[from_begin1, from_end1, from_end3, from_end4]);
30    |                                                      --------- immutable borrow later used here
31
32 error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
33   --> $DIR/borrowck-slice-pattern-element-loan.rs:48:23
34    |
35 LL |     if let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s {
36    |                                   ------------- immutable borrow occurs here
37 ...
38 LL |         if let [_, _, ref mut from_begin2, ..] = *s {
39    |                       ^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
40 LL |             nop(&[from_begin2, from_end1, from_end3, from_end4]);
41    |                                           --------- immutable borrow later used here
42
43 error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
44   --> $DIR/borrowck-slice-pattern-element-loan.rs:51:26
45    |
46 LL |     if let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s {
47    |                                   ------------- immutable borrow occurs here
48 ...
49 LL |         if let [_, _, _, ref mut from_begin3, ..] = *s {
50    |                          ^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
51 LL |             nop(&[from_begin3, from_end1, from_end3, from_end4]);
52    |                                           --------- immutable borrow later used here
53
54 error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
55   --> $DIR/borrowck-slice-pattern-element-loan.rs:59:21
56    |
57 LL |     if let [ref from_begin0, ref from_begin1, _, ref from_begin3, _, ..] = *s {
58    |                                                  --------------- immutable borrow occurs here
59 ...
60 LL |         if let [.., ref mut from_end2, _] = *s {
61    |                     ^^^^^^^^^^^^^^^^^ mutable borrow occurs here
62 LL |             nop(&[from_begin0, from_begin1, from_begin3, from_end2]);
63    |                                             ----------- immutable borrow later used here
64
65 error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
66   --> $DIR/borrowck-slice-pattern-element-loan.rs:62:21
67    |
68 LL |     if let [ref from_begin0, ref from_begin1, _, ref from_begin3, _, ..] = *s {
69    |                                                  --------------- immutable borrow occurs here
70 ...
71 LL |         if let [.., ref mut from_end3, _,  _] = *s {
72    |                     ^^^^^^^^^^^^^^^^^ mutable borrow occurs here
73 LL |             nop(&[from_begin0, from_begin1, from_begin3, from_end3]);
74    |                                             ----------- immutable borrow later used here
75
76 error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
77   --> $DIR/borrowck-slice-pattern-element-loan.rs:65:21
78    |
79 LL |     if let [ref from_begin0, ref from_begin1, _, ref from_begin3, _, ..] = *s {
80    |                              --------------- immutable borrow occurs here
81 ...
82 LL |         if let [.., ref mut from_end4, _, _, _] = *s {
83    |                     ^^^^^^^^^^^^^^^^^ mutable borrow occurs here
84 LL |             nop(&[from_begin0, from_begin1, from_begin3, from_end4]);
85    |                                ----------- immutable borrow later used here
86
87 error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
88   --> $DIR/borrowck-slice-pattern-element-loan.rs:82:20
89    |
90 LL |     if let [ref first, ref second, ..] = *s {
91    |                        ---------- immutable borrow occurs here
92 LL |         if let [_, ref mut tail @ ..] = *s {
93    |                    ^^^^^^^^^^^^^^^^^ mutable borrow occurs here
94 LL |             nop(&[first, second]);
95    |                          ------ immutable borrow later used here
96
97 error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
98   --> $DIR/borrowck-slice-pattern-element-loan.rs:100:17
99    |
100 LL |     if let [.., ref second, ref first] = *s {
101    |                 ---------- immutable borrow occurs here
102 LL |         if let [ref mut tail @ .., _] = *s {
103    |                 ^^^^^^^^^^^^^^^^^ mutable borrow occurs here
104 LL |             nop(&[first, second]);
105    |                          ------ immutable borrow later used here
106
107 error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
108   --> $DIR/borrowck-slice-pattern-element-loan.rs:109:17
109    |
110 LL |     if let [_, _, _, ref s1 @ ..] = *s {
111    |                      ----------- immutable borrow occurs here
112 LL |         if let [ref mut s2 @ .., _, _, _] = *s {
113    |                 ^^^^^^^^^^^^^^^ mutable borrow occurs here
114 LL |             nop_subslice(s1);
115    |                          -- immutable borrow later used here
116
117 error: aborting due to 11 previous errors
118
119 For more information about this error, try `rustc --explain E0502`.