about summary refs log tree commit diff
path: root/tests/ui/traits/default_method_simple.rs
blob: 96fad94f57ae404f60443e82c01c8fe1feefab80 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
//! Checks basic default method functionality.

//@ run-pass

trait Foo {
    fn f(&self) {
        println!("Hello!");
        self.g();
    }
    fn g(&self);
}

struct A;

impl Foo for A {
    fn g(&self) {
        println!("Goodbye!");
    }
}

pub fn main() {
    let a = A;
    a.f();
}