summaryrefslogtreecommitdiffstats
path: root/src/test/ui/traits/default-method/self.rs
blob: cdf4d1e148c8402d401e17760f42c4d4300b0d8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// run-pass


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

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

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