rust/src/test/compile-fail/use-after-move-self.rs
Brendan Zabarauskas 4fc0452ace Remove re-exports of std::io::stdio::{print, println} in the prelude.
The `print!` and `println!` macros are now the preferred method of printing, and so there is no reason to export the `stdio` functions in the prelude. The functions have also been replaced by their macro counterparts in the tutorial and other documentation so that newcomers don't get confused about what they should be using.
2014-01-11 10:46:00 +11:00

18 lines
249 B
Rust

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