rust/tests/ui/traits/default-method/trivial.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

22 lines
305 B
Rust
Raw Normal View History

// run-pass
2012-12-17 22:57:37 +00:00
2012-08-13 18:11:09 +00:00
trait Cat {
fn meow(&self) -> bool;
fn scratch(&self) -> bool;
fn purr(&self) -> bool { true }
2012-08-13 18:11:09 +00:00
}
impl Cat for isize {
fn meow(&self) -> bool {
2012-08-13 18:11:09 +00:00
self.scratch()
}
fn scratch(&self) -> bool {
2012-08-13 18:11:09 +00:00
self.purr()
}
}
pub fn main() {
2013-03-29 01:39:09 +00:00
assert!(5.meow());
2012-08-13 18:11:09 +00:00
}