rust/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-slice.stderr

118 lines
6.2 KiB
Plaintext
Raw Normal View History

2018-07-04 07:45:01 +01:00
error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
--> $DIR/borrowck-slice-pattern-element-loan-slice.rs:8:20
2018-07-04 07:45:01 +01:00
|
LL | if let [ref first, ref second, ..] = *s {
| ---------- immutable borrow occurs here
2019-03-09 15:03:44 +03:00
LL | if let [_, ref mut second2, ref mut third, ..] = *s {
2018-07-04 07:45:01 +01:00
| ^^^^^^^^^^^^^^^^ mutable borrow occurs here
LL | nop(&[first, second, second2, third]);
| ------ immutable borrow later used here
2018-07-04 07:45:01 +01:00
error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
--> $DIR/borrowck-slice-pattern-element-loan-slice.rs:16:21
2018-07-04 07:45:01 +01:00
|
LL | if let [.., ref fourth, ref third, _, ref first] = *s {
| --------- immutable borrow occurs here
2019-03-09 15:03:44 +03:00
LL | if let [.., ref mut third2, _, _] = *s {
2018-07-04 07:45:01 +01:00
| ^^^^^^^^^^^^^^ mutable borrow occurs here
LL | nop(&[first, third, third2, fourth]);
| ----- immutable borrow later used here
2018-07-04 07:45:01 +01:00
error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
--> $DIR/borrowck-slice-pattern-element-loan-slice.rs:24:20
2018-07-04 07:45:01 +01:00
|
LL | if let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s {
| ------------- immutable borrow occurs here
2019-03-09 15:03:44 +03:00
LL | if let [_, ref mut from_begin1, ..] = *s {
2018-07-04 07:45:01 +01:00
| ^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
LL | nop(&[from_begin1, from_end1, from_end3, from_end4]);
| --------- immutable borrow later used here
2018-07-04 07:45:01 +01:00
error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
--> $DIR/borrowck-slice-pattern-element-loan-slice.rs:27:23
2018-07-04 07:45:01 +01:00
|
LL | if let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s {
| ------------- immutable borrow occurs here
...
2019-03-09 15:03:44 +03:00
LL | if let [_, _, ref mut from_begin2, ..] = *s {
2018-07-04 07:45:01 +01:00
| ^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
LL | nop(&[from_begin2, from_end1, from_end3, from_end4]);
| --------- immutable borrow later used here
2018-07-04 07:45:01 +01:00
error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
--> $DIR/borrowck-slice-pattern-element-loan-slice.rs:30:26
2018-07-04 07:45:01 +01:00
|
LL | if let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s {
| ------------- immutable borrow occurs here
...
2019-03-09 15:03:44 +03:00
LL | if let [_, _, _, ref mut from_begin3, ..] = *s {
2018-07-04 07:45:01 +01:00
| ^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
LL | nop(&[from_begin3, from_end1, from_end3, from_end4]);
| --------- immutable borrow later used here
2018-07-04 07:45:01 +01:00
error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
--> $DIR/borrowck-slice-pattern-element-loan-slice.rs:35:21
2018-07-04 07:45:01 +01:00
|
LL | if let [ref from_begin0, ref from_begin1, _, ref from_begin3, _, ..] = *s {
| --------------- immutable borrow occurs here
2019-03-09 15:03:44 +03:00
LL | if let [.., ref mut from_end2, _] = *s {
2018-07-04 07:45:01 +01:00
| ^^^^^^^^^^^^^^^^^ mutable borrow occurs here
LL | nop(&[from_begin0, from_begin1, from_begin3, from_end2]);
| ----------- immutable borrow later used here
2018-07-04 07:45:01 +01:00
error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
--> $DIR/borrowck-slice-pattern-element-loan-slice.rs:38:21
2018-07-04 07:45:01 +01:00
|
LL | if let [ref from_begin0, ref from_begin1, _, ref from_begin3, _, ..] = *s {
| --------------- immutable borrow occurs here
...
2019-03-09 15:03:44 +03:00
LL | if let [.., ref mut from_end3, _, _] = *s {
2018-07-04 07:45:01 +01:00
| ^^^^^^^^^^^^^^^^^ mutable borrow occurs here
LL | nop(&[from_begin0, from_begin1, from_begin3, from_end3]);
| ----------- immutable borrow later used here
2018-07-04 07:45:01 +01:00
error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
--> $DIR/borrowck-slice-pattern-element-loan-slice.rs:41:21
2018-07-04 07:45:01 +01:00
|
LL | if let [ref from_begin0, ref from_begin1, _, ref from_begin3, _, ..] = *s {
| --------------- immutable borrow occurs here
...
2019-03-09 15:03:44 +03:00
LL | if let [.., ref mut from_end4, _, _, _] = *s {
2018-07-04 07:45:01 +01:00
| ^^^^^^^^^^^^^^^^^ mutable borrow occurs here
LL | nop(&[from_begin0, from_begin1, from_begin3, from_end4]);
| ----------- immutable borrow later used here
2018-07-04 07:45:01 +01:00
error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
--> $DIR/borrowck-slice-pattern-element-loan-slice.rs:49:20
2018-07-04 07:45:01 +01:00
|
LL | if let [ref first, ref second, ..] = *s {
| ---------- immutable borrow occurs here
LL | if let [_, ref mut tail @ ..] = *s {
| ^^^^^^^^^^^^^^^^^ mutable borrow occurs here
2018-07-04 07:45:01 +01:00
LL | nop(&[first, second]);
| ------ immutable borrow later used here
2018-07-04 07:45:01 +01:00
error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
--> $DIR/borrowck-slice-pattern-element-loan-slice.rs:58:17
2018-07-04 07:45:01 +01:00
|
LL | if let [.., ref second, ref first] = *s {
| ---------- immutable borrow occurs here
LL | if let [ref mut tail @ .., _] = *s {
| ^^^^^^^^^^^^^^^^^ mutable borrow occurs here
2018-07-04 07:45:01 +01:00
LL | nop(&[first, second]);
| ------ immutable borrow later used here
2018-07-04 07:45:01 +01:00
error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
--> $DIR/borrowck-slice-pattern-element-loan-slice.rs:67:17
2018-07-04 07:45:01 +01:00
|
LL | if let [_, _, _, ref s1 @ ..] = *s {
| ----------- immutable borrow occurs here
LL | if let [ref mut s2 @ .., _, _, _] = *s {
| ^^^^^^^^^^^^^^^ mutable borrow occurs here
2018-07-04 07:45:01 +01:00
LL | nop_subslice(s1);
| -- immutable borrow later used here
2018-07-04 07:45:01 +01:00
error: aborting due to 11 previous errors
For more information about this error, try `rustc --explain E0502`.