rust/src/test/ui/traits/traits-default-method-trivial.rs
2019-07-27 18:56:16 +03:00

22 lines
305 B
Rust

// 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());
}