mirror of
https://github.com/rust-lang/rust
synced 2024-11-05 20:45:15 +00:00
26 lines
292 B
Rust
26 lines
292 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();
|
|
}
|