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