rust/tests/ui/self/move-self.rs
2024-02-16 20:02:50 +00:00

20 lines
238 B
Rust

//@ 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();
}