about summary refs log tree commit diff
path: root/src/test/compile-fail/use-after-move-self.rs
blob: 11f37df45417cc84c05f083a9c2235e408545dc0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
struct S {
    x: ~int
}

pub impl S {
    fn foo(self) -> int {
        self.bar();
        return *self.x;  //~ ERROR use of moved value
    }

    fn bar(self) {}
}

fn main() {
    let x = S { x: ~1 };
    io::println(x.foo().to_str());
}