1
Fork 0
rust/src/test/ui/use/use-after-move-self.rs

20 lines
286 B
Rust
Raw Normal View History

2015-01-07 18:53:58 -08:00
#![feature(box_syntax)]
struct S {
x: Box<isize>,
}
impl S {
pub fn foo(self) -> isize {
self.bar();
return *self.x; //~ ERROR use of moved value: `self`
}
pub fn bar(self) {}
}
fn main() {
let x = S { x: box 1 };
println!("{}", x.foo());
}