rust/src/test/run-pass/move-self.rs
2013-02-15 02:49:55 -08:00

19 lines
202 B
Rust

struct S {
x: ~str
}
impl S {
fn foo(self) {
self.bar();
}
fn bar(self) {
io::println(self.x);
}
}
pub fn main() {
let x = S { x: ~"Hello!" };
x.foo();
}