rust/tests/ui/self/move-self.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

20 lines
237 B
Rust
Raw Normal View History

// run-pass
struct S {
x: String
}
impl S {
pub fn foo(self) {
2013-02-15 10:44:18 +00:00
self.bar();
}
pub fn bar(self) {
println!("{}", self.x);
}
}
pub fn main() {
let x = S { x: "Hello!".to_string() };
x.foo();
}