]> git.proxmox.com Git - rustc.git/blob - tests/ui/borrowck/borrowck-slice-pattern-element-loan-array.stderr
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / ui / borrowck / borrowck-slice-pattern-element-loan-array.stderr
1 error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
2 --> $DIR/borrowck-slice-pattern-element-loan-array.rs:6:13
3 |
4 LL | let [ref first, ref second, ..] = *s;
5 | ---------- immutable borrow occurs here
6 LL | 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-array.rs:12:14
13 |
14 LL | let [.., ref fourth, ref third, _, ref first] = *s;
15 | --------- immutable borrow occurs here
16 LL | 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-array.rs:19:16
23 |
24 LL | let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s;
25 | ------------- immutable borrow occurs here
26 LL |
27 LL | let [_, _, ref mut from_begin2, ..] = *s;
28 | ^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
29 LL | nop(&[from_begin2, 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-array.rs:21:19
34 |
35 LL | let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s;
36 | ------------- immutable borrow occurs here
37 ...
38 LL | let [_, _, _, ref mut from_begin3, ..] = *s;
39 | ^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
40 LL | nop(&[from_begin3, 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-array.rs:26:14
45 |
46 LL | let [ref from_begin0, ref from_begin1, _, ref from_begin3, _, ..] = *s;
47 | --------------- immutable borrow occurs here
48 LL |
49 LL | let [.., ref mut from_end3, _, _] = *s;
50 | ^^^^^^^^^^^^^^^^^ mutable borrow occurs here
51 LL | nop(&[from_begin0, from_begin1, from_begin3, from_end3]);
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-array.rs:32:13
56 |
57 LL | let [ref first, ref second, ..] = *s;
58 | ---------- immutable borrow occurs here
59 LL | let [_, ref mut tail @ ..] = *s;
60 | ^^^^^^^^^^^^ mutable borrow occurs here
61 LL | nop(&[first, second]);
62 | ------ immutable borrow later used here
63
64 error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
65 --> $DIR/borrowck-slice-pattern-element-loan-array.rs:39:10
66 |
67 LL | let [.., ref second, ref first] = *s;
68 | ---------- immutable borrow occurs here
69 LL | let [ref mut tail @ .., _] = *s;
70 | ^^^^^^^^^^^^ mutable borrow occurs here
71 LL | nop(&[first, second]);
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-array.rs:46:10
76 |
77 LL | let [_, ref s1 @ ..] = *s;
78 | ------ immutable borrow occurs here
79 LL | let [ref mut s2 @ .., _, _] = *s;
80 | ^^^^^^^^^^ mutable borrow occurs here
81 LL | nop_subslice(s1);
82 | -- immutable borrow later used here
83
84 error: aborting due to 8 previous errors
85
86 For more information about this error, try `rustc --explain E0502`.