rust/src/test/compile-fail/borrowck-vec-pattern-nesting.rs
Björn Steinbrink bdc182cc41 Use static string with fail!() and remove fail!(fmt!())
fail!() used to require owned strings but can handle static strings
now. Also, it can pass its arguments to fmt!() on its own, no need for
the caller to call fmt!() itself.
2013-05-14 16:36:23 +02:00

21 lines
400 B
Rust

fn a() {
let mut vec = [~1, ~2, ~3];
match vec {
[~ref _a] => {
vec[0] = ~4; //~ ERROR cannot assign to `vec[]` because it is borrowed
}
_ => fail!("foo")
}
}
fn b() {
let mut vec = [~1, ~2, ~3];
match vec {
[.._b] => {
vec[0] = ~4; //~ ERROR cannot assign to `vec[]` because it is borrowed
}
}
}
fn main() {}