bdc182cc41
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.
21 lines
400 B
Rust
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() {}
|