summary refs log tree commit diff
path: root/src/test/run-pass/move-self.rs
blob: 5598839e31dc6a61af23985c5c126fcccad600e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
struct S {
    x: ~str
}

impl S {
    fn foo(self) {
        (move self).bar();
    }

    fn bar(self) {
        io::println(self.x);
    }
}

fn main() {
    let x = S { x: ~"Hello!" };
    x.foo();
}