rust/tests/ui/default-method-simple.rs
2023-01-11 09:32:08 +00:00

27 lines
291 B
Rust

// run-pass
#![allow(dead_code)]
trait Foo {
fn f(&self) {
println!("Hello!");
self.g();
}
fn g(&self);
}
struct A {
x: isize
}
impl Foo for A {
fn g(&self) {
println!("Goodbye!");
}
}
pub fn main() {
let a = A { x: 1 };
a.f();
}