|
| 1 | +error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable |
| 2 | + --> $DIR/borrowck-slice-pattern-element-loan.rs:28: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 { //~ERROR |
| 7 | + | ^^^^^^^^^^^^^^^^ mutable borrow occurs here |
| 8 | +LL | nop(&[first, second, second2, third]); |
| 9 | + | ------ 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:44: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 { //~ERROR |
| 17 | + | ^^^^^^^^^^^^^^ mutable borrow occurs here |
| 18 | +LL | nop(&[first, third, third2, fourth]); |
| 19 | + | ----- 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:55: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 { //~ERROR |
| 28 | + | ^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here |
| 29 | +LL | nop(&[from_begin1, from_end1, from_end3, from_end4]); |
| 30 | + | --------- 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:58: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 { //~ERROR |
| 39 | + | ^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here |
| 40 | +LL | nop(&[from_begin2, from_end1, from_end3, from_end4]); |
| 41 | + | --------- 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:61: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 { //~ERROR |
| 50 | + | ^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here |
| 51 | +LL | nop(&[from_begin3, from_end1, from_end3, from_end4]); |
| 52 | + | --------- 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:69: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 { //~ERROR |
| 61 | + | ^^^^^^^^^^^^^^^^^ mutable borrow occurs here |
| 62 | +LL | nop(&[from_begin0, from_begin1, from_begin3, from_end2]); |
| 63 | + | ----------- 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:72: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 { //~ERROR |
| 72 | + | ^^^^^^^^^^^^^^^^^ mutable borrow occurs here |
| 73 | +LL | nop(&[from_begin0, from_begin1, from_begin3, from_end3]); |
| 74 | + | ----------- 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:75: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 { //~ERROR |
| 83 | + | ^^^^^^^^^^^^^^^^^ mutable borrow occurs here |
| 84 | +LL | nop(&[from_begin0, from_begin1, from_begin3, from_end4]); |
| 85 | + | ----------- 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:92:20 |
| 89 | + | |
| 90 | +LL | if let [ref first, ref second, ..] = *s { |
| 91 | + | ---------- immutable borrow occurs here |
| 92 | +LL | if let [_, ref mut tail..] = *s { //~ERROR |
| 93 | + | ^^^^^^^^^^^^ mutable borrow occurs here |
| 94 | +LL | nop(&[first, second]); |
| 95 | + | ------ 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:110:17 |
| 99 | + | |
| 100 | +LL | if let [.., ref second, ref first] = *s { |
| 101 | + | ---------- immutable borrow occurs here |
| 102 | +LL | if let [ref mut tail.., _] = *s { //~ERROR |
| 103 | + | ^^^^^^^^^^^^ mutable borrow occurs here |
| 104 | +LL | nop(&[first, second]); |
| 105 | + | ------ 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:119:17 |
| 109 | + | |
| 110 | +LL | if let [_, _, _, ref s1..] = *s { |
| 111 | + | ------ immutable borrow occurs here |
| 112 | +LL | if let [ref mut s2.., _, _, _] = *s { //~ERROR |
| 113 | + | ^^^^^^^^^^ mutable borrow occurs here |
| 114 | +LL | nop_subslice(s1); |
| 115 | + | -- 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`. |
0 commit comments