rust/tests/ui/traits/default-method/self.rs
2023-01-11 09:32:08 +00:00

19 lines
262 B
Rust

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