]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/borrowck-slice-pattern-element-loan-slice.stderr
Rollup merge of #106726 - cmorin6:fix-comment-typos, r=Nilstrieb
[rust.git] / tests / ui / borrowck / borrowck-slice-pattern-element-loan-slice.stderr
1 error[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    |
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-slice.rs:14: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-slice.rs:22:20
23    |
24 LL |     if let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s {
25    |                    ------------- immutable borrow occurs here
26 LL |         if let [_, ref mut from_begin1, ..] = *s {
27    |                    ^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
28 LL |             nop(&[from_begin1, from_end1, from_end3, from_end4]);
29    |                                                      --------- immutable borrow later used here
30
31 error[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    |
34 LL |     if let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s {
35    |                                   ------------- immutable borrow occurs here
36 ...
37 LL |         if let [_, _, ref mut from_begin2, ..] = *s {
38    |                       ^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
39 LL |             nop(&[from_begin2, from_end1, from_end3, from_end4]);
40    |                                           --------- immutable borrow later used here
41
42 error[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    |
45 LL |     if let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s {
46    |                                   ------------- immutable borrow occurs here
47 ...
48 LL |         if let [_, _, _, ref mut from_begin3, ..] = *s {
49    |                          ^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
50 LL |             nop(&[from_begin3, from_end1, from_end3, from_end4]);
51    |                                           --------- immutable borrow later used here
52
53 error[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    |
56 LL |     if let [ref from_begin0, ref from_begin1, _, ref from_begin3, _, ..] = *s {
57    |                                                  --------------- immutable borrow occurs here
58 LL |         if let [.., ref mut from_end2, _] = *s {
59    |                     ^^^^^^^^^^^^^^^^^ mutable borrow occurs here
60 LL |             nop(&[from_begin0, from_begin1, from_begin3, from_end2]);
61    |                                             ----------- immutable borrow later used here
62
63 error[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    |
66 LL |     if let [ref from_begin0, ref from_begin1, _, ref from_begin3, _, ..] = *s {
67    |                                                  --------------- immutable borrow occurs here
68 ...
69 LL |         if let [.., ref mut from_end3, _,  _] = *s {
70    |                     ^^^^^^^^^^^^^^^^^ mutable borrow occurs here
71 LL |             nop(&[from_begin0, from_begin1, from_begin3, from_end3]);
72    |                                             ----------- immutable borrow later used here
73
74 error[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    |
77 LL |     if let [ref from_begin0, ref from_begin1, _, ref from_begin3, _, ..] = *s {
78    |                              --------------- immutable borrow occurs here
79 ...
80 LL |         if let [.., ref mut from_end4, _, _, _] = *s {
81    |                     ^^^^^^^^^^^^^^^^^ mutable borrow occurs here
82 LL |             nop(&[from_begin0, from_begin1, from_begin3, from_end4]);
83    |                                ----------- immutable borrow later used here
84
85 error[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    |
88 LL |     if let [ref first, ref second, ..] = *s {
89    |                        ---------- immutable borrow occurs here
90 LL |         if let [_, ref mut tail @ ..] = *s {
91    |                    ^^^^^^^^^^^^ mutable borrow occurs here
92 LL |             nop(&[first, second]);
93    |                          ------ immutable borrow later used here
94
95 error[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    |
98 LL |     if let [.., ref second, ref first] = *s {
99    |                 ---------- immutable borrow occurs here
100 LL |         if let [ref mut tail @ .., _] = *s {
101    |                 ^^^^^^^^^^^^ mutable borrow occurs here
102 LL |             nop(&[first, second]);
103    |                          ------ immutable borrow later used here
104
105 error[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    |
108 LL |     if let [_, _, _, ref s1 @ ..] = *s {
109    |                      ------ immutable borrow occurs here
110 LL |         if let [ref mut s2 @ .., _, _, _] = *s {
111    |                 ^^^^^^^^^^ mutable borrow occurs here
112 LL |             nop_subslice(s1);
113    |                          -- immutable borrow later used here
114
115 error: aborting due to 11 previous errors
116
117 For more information about this error, try `rustc --explain E0502`.