]>
Commit | Line | Data |
---|---|---|
b7449926 | 1 | // run-pass |
0bf4aa26 | 2 | #![allow(dead_code)] |
223e47cc | 3 | |
c34b1796 AL |
4 | trait Foo { fn f(&self) -> isize; } |
5 | trait Bar : Foo { fn g(&self) -> isize; } | |
223e47cc | 6 | |
c34b1796 AL |
7 | struct A { x: isize } |
8 | ||
9 | impl Foo for A { fn f(&self) -> isize { 10 } } | |
223e47cc LB |
10 | |
11 | impl Bar for A { | |
12 | // Testing that this impl can call the impl of Foo | |
c34b1796 | 13 | fn g(&self) -> isize { self.f() } |
223e47cc LB |
14 | } |
15 | ||
16 | pub fn main() { | |
17 | let a = &A { x: 3 }; | |
970d7e83 | 18 | assert_eq!(a.g(), 10); |
223e47cc | 19 | } |