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

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

    fn bar(self) {}
}

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