2e10ea58c3
The tail portion of the pattern effectively borrows a vector, but the borrow checker knew nothing about this. r=catamorphism
22 lines
374 B
Rust
22 lines
374 B
Rust
fn a() {
|
|
let mut vec = [~1, ~2, ~3];
|
|
match vec {
|
|
[~ref _a] => {
|
|
vec[0] = ~4; //~ ERROR prohibited due to outstanding loan
|
|
}
|
|
_ => fail ~"foo"
|
|
}
|
|
}
|
|
|
|
fn b() {
|
|
let mut vec = [~1, ~2, ~3];
|
|
match vec {
|
|
[.._b] => {
|
|
vec[0] = ~4; //~ ERROR prohibited due to outstanding loan
|
|
}
|
|
}
|
|
}
|
|
|
|
fn main() {}
|
|
|