rust/tests/ui/default-method-simple.rs

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

27 lines
291 B
Rust
Raw Normal View History

// run-pass
#![allow(dead_code)]
2012-12-17 16:57:37 -06:00
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();
}