rust/src/test/compile-fail/borrowck-move-out-of-tuple-struct-with-dtor.rs

23 lines
473 B
Rust
Raw Normal View History

struct S(~str);
impl Drop for S {
2013-06-24 12:30:35 -05:00
fn drop(&self) { println(**self); }
}
fn move_in_match() {
match S(~"foo") {
S(_s) => {}
//~^ ERROR cannot move out of type `S`, which defines the `Drop` trait
}
}
fn move_in_let() {
let S(_s) = S(~"foo");
//~^ ERROR cannot move out of type `S`, which defines the `Drop` trait
}
fn move_in_fn_arg(S(_s): S) {
//~^ ERROR cannot move out of type `S`, which defines the `Drop` trait
}
fn main() {}