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

20 lines
289 B
Rust
Raw Normal View History

2015-01-08 02:53:58 +00: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.x`
}
pub fn bar(self) {}
}
fn main() {
let x = S { x: box 1 };
println!("{}", x.foo());
}