2018-08-30 14:18:55 +02:00
|
|
|
//@ run-pass
|
2012-12-17 14:57:37 -08:00
|
|
|
|
2012-11-24 14:01:57 -08:00
|
|
|
trait Foo {
|
2015-03-25 17:06:52 -07:00
|
|
|
fn a(&self) -> isize;
|
|
|
|
fn b(&self) -> isize {
|
2012-11-24 14:01:57 -08:00
|
|
|
self.a() + 2
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-03-25 17:06:52 -07:00
|
|
|
impl Foo for isize {
|
|
|
|
fn a(&self) -> isize {
|
2012-11-24 14:01:57 -08:00
|
|
|
3
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-02-01 19:43:17 -08:00
|
|
|
pub fn main() {
|
2013-05-18 22:02:45 -04:00
|
|
|
assert_eq!(3.b(), 5);
|
2012-11-24 14:01:57 -08:00
|
|
|
}
|