2019-11-22 23:15:11 +00:00
|
|
|
error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
|
2019-12-30 00:23:42 +00:00
|
|
|
--> $DIR/borrowck-slice-pattern-element-loan-array.rs:6:13
|
2019-11-22 23:15:11 +00:00
|
|
|
|
|
|
|
|
LL | let [ref first, ref second, ..] = *s;
|
|
|
|
| ---------- immutable borrow occurs here
|
|
|
|
LL | let [_, ref mut second2, ref mut third, ..] = *s;
|
|
|
|
| ^^^^^^^^^^^^^^^^ mutable borrow occurs here
|
|
|
|
LL | nop(&[first, second, second2, third]);
|
|
|
|
| ------ immutable borrow later used here
|
|
|
|
|
|
|
|
error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
|
2019-12-30 00:23:42 +00:00
|
|
|
--> $DIR/borrowck-slice-pattern-element-loan-array.rs:12:14
|
2019-11-22 23:15:11 +00:00
|
|
|
|
|
|
|
|
LL | let [.., ref fourth, ref third, _, ref first] = *s;
|
|
|
|
| --------- immutable borrow occurs here
|
|
|
|
LL | let [.., ref mut third2, _, _] = *s;
|
|
|
|
| ^^^^^^^^^^^^^^ mutable borrow occurs here
|
|
|
|
LL | nop(&[first, third, third2, fourth]);
|
|
|
|
| ----- immutable borrow later used here
|
|
|
|
|
|
|
|
error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
|
2019-12-30 00:23:42 +00:00
|
|
|
--> $DIR/borrowck-slice-pattern-element-loan-array.rs:19:16
|
2019-11-22 23:15:11 +00:00
|
|
|
|
|
|
|
|
LL | let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s;
|
|
|
|
| ------------- immutable borrow occurs here
|
2022-06-08 18:07:59 +00:00
|
|
|
LL |
|
2019-11-22 23:15:11 +00:00
|
|
|
LL | let [_, _, ref mut from_begin2, ..] = *s;
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
|
|
|
|
LL | nop(&[from_begin2, from_end1, from_end3, from_end4]);
|
|
|
|
| --------- immutable borrow later used here
|
|
|
|
|
|
|
|
error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
|
2019-12-30 00:23:42 +00:00
|
|
|
--> $DIR/borrowck-slice-pattern-element-loan-array.rs:21:19
|
2019-11-22 23:15:11 +00:00
|
|
|
|
|
|
|
|
LL | let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s;
|
|
|
|
| ------------- immutable borrow occurs here
|
|
|
|
...
|
|
|
|
LL | let [_, _, _, ref mut from_begin3, ..] = *s;
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
|
|
|
|
LL | nop(&[from_begin3, from_end1, from_end3, from_end4]);
|
|
|
|
| --------- immutable borrow later used here
|
|
|
|
|
|
|
|
error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
|
2019-12-30 00:23:42 +00:00
|
|
|
--> $DIR/borrowck-slice-pattern-element-loan-array.rs:26:14
|
2019-11-22 23:15:11 +00:00
|
|
|
|
|
|
|
|
LL | let [ref from_begin0, ref from_begin1, _, ref from_begin3, _, ..] = *s;
|
|
|
|
| --------------- immutable borrow occurs here
|
2022-06-08 18:07:59 +00:00
|
|
|
LL |
|
2019-11-22 23:15:11 +00:00
|
|
|
LL | let [.., ref mut from_end3, _, _] = *s;
|
|
|
|
| ^^^^^^^^^^^^^^^^^ mutable borrow occurs here
|
|
|
|
LL | nop(&[from_begin0, from_begin1, from_begin3, from_end3]);
|
|
|
|
| ----------- immutable borrow later used here
|
|
|
|
|
|
|
|
error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
|
2019-12-30 00:23:42 +00:00
|
|
|
--> $DIR/borrowck-slice-pattern-element-loan-array.rs:32:13
|
2019-11-22 23:15:11 +00:00
|
|
|
|
|
|
|
|
LL | let [ref first, ref second, ..] = *s;
|
|
|
|
| ---------- immutable borrow occurs here
|
|
|
|
LL | let [_, ref mut tail @ ..] = *s;
|
2022-09-03 22:55:53 +00:00
|
|
|
| ^^^^^^^^^^^^ mutable borrow occurs here
|
2019-11-22 23:15:11 +00:00
|
|
|
LL | nop(&[first, second]);
|
|
|
|
| ------ immutable borrow later used here
|
|
|
|
|
|
|
|
error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
|
2019-12-30 00:23:42 +00:00
|
|
|
--> $DIR/borrowck-slice-pattern-element-loan-array.rs:39:10
|
2019-11-22 23:15:11 +00:00
|
|
|
|
|
|
|
|
LL | let [.., ref second, ref first] = *s;
|
|
|
|
| ---------- immutable borrow occurs here
|
|
|
|
LL | let [ref mut tail @ .., _] = *s;
|
2022-09-03 22:55:53 +00:00
|
|
|
| ^^^^^^^^^^^^ mutable borrow occurs here
|
2019-11-22 23:15:11 +00:00
|
|
|
LL | nop(&[first, second]);
|
|
|
|
| ------ immutable borrow later used here
|
|
|
|
|
|
|
|
error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
|
2019-12-30 00:23:42 +00:00
|
|
|
--> $DIR/borrowck-slice-pattern-element-loan-array.rs:46:10
|
2019-11-22 23:15:11 +00:00
|
|
|
|
|
|
|
|
LL | let [_, ref s1 @ ..] = *s;
|
2022-09-03 22:55:53 +00:00
|
|
|
| ------ immutable borrow occurs here
|
2019-11-22 23:15:11 +00:00
|
|
|
LL | let [ref mut s2 @ .., _, _] = *s;
|
2022-09-03 22:55:53 +00:00
|
|
|
| ^^^^^^^^^^ mutable borrow occurs here
|
2019-11-22 23:15:11 +00:00
|
|
|
LL | nop_subslice(s1);
|
|
|
|
| -- immutable borrow later used here
|
|
|
|
|
|
|
|
error: aborting due to 8 previous errors
|
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0502`.
|