about summary refs log tree commit diff
path: root/src/test/ui/use/use-after-move-self.rs
blob: a6f6c45573d0ac80c83875887118535275bfc077 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#![feature(box_syntax)]

struct S {
    x: Box<isize>,
}

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

    pub fn bar(self) {}
}

fn main() {
    let x = S { x: box 1 };
    println!("{}", x.foo());
}