rust/src/test/compile-fail/use-after-move-self.rs
2013-05-12 16:35:18 -07:00

18 lines
253 B
Rust

struct S {
x: ~int
}
pub impl S {
fn foo(self) -> int {
self.bar();
return *self.x; //~ ERROR use of partially moved value
}
fn bar(self) {}
}
fn main() {
let x = S { x: ~1 };
io::println(x.foo().to_str());
}