summary refs log tree commit diff
path: root/src/test/compile-fail/use-after-move-self.rs
blob: c38f4821b881e4b04c745decee451f2bba38c0f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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().to_str());
}