2013-05-22 05:54:35 -05:00
|
|
|
// Test that we do not permit moves from &[] matched by a vec pattern.
|
|
|
|
|
|
|
|
struct Foo {
|
|
|
|
string: ~str
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn main() {
|
|
|
|
let x = [
|
|
|
|
Foo { string: ~"foo" },
|
|
|
|
Foo { string: ~"bar" },
|
|
|
|
Foo { string: ~"baz" }
|
|
|
|
];
|
|
|
|
match x {
|
2013-06-20 14:11:20 -05:00
|
|
|
[_, ..tail] => {
|
2013-05-22 05:54:35 -05:00
|
|
|
match tail {
|
|
|
|
[Foo { string: a }, Foo { string: b }] => {
|
|
|
|
//~^ ERROR cannot move out of dereference of & pointer
|
|
|
|
//~^^ ERROR cannot move out of dereference of & pointer
|
|
|
|
}
|
|
|
|
_ => {
|
|
|
|
::std::util::unreachable();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
let z = copy tail[0];
|
|
|
|
debug!(fmt!("%?", z));
|
|
|
|
}
|
|
|
|
_ => {
|
|
|
|
::std::util::unreachable();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|