summaryrefslogtreecommitdiffstats
path: root/tests/ui/traits/default-method/trivial.rs
blob: dc41938ec8993572ac925366e4db95a4ae39efbc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// run-pass


trait Cat {
    fn meow(&self) -> bool;
    fn scratch(&self) -> bool;
    fn purr(&self) -> bool { true }
}

impl Cat for isize {
    fn meow(&self) -> bool {
        self.scratch()
    }
    fn scratch(&self) -> bool {
        self.purr()
    }
}

pub fn main() {
    assert!(5.meow());
}