about summary refs log tree commit diff
path: root/tests/ui/self/move-self.rs
blob: 94310382dd0b772138f35b5e01d954af8d10f422 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//@ run-pass
struct S {
    x: String
}

impl S {
    pub fn foo(self) {
        self.bar();
    }

    pub fn bar(self) {
        println!("{}", self.x);
    }
}

pub fn main() {
    let x = S { x: "Hello!".to_string() };
    x.foo();
}