]>
Commit | Line | Data |
---|---|---|
b7449926 | 1 | // run-pass |
0bf4aa26 | 2 | #![allow(dead_code)] |
223e47cc LB |
3 | // B and C both require A, so D does as well, twice, but that's just fine |
4 | ||
c34b1796 AL |
5 | |
6 | trait A { fn a(&self) -> isize; } | |
7 | trait B: A { fn b(&self) -> isize; } | |
8 | trait C: A { fn c(&self) -> isize; } | |
9 | trait D: B + C { fn d(&self) -> isize; } | |
223e47cc LB |
10 | |
11 | struct S { bogus: () } | |
12 | ||
c34b1796 AL |
13 | impl A for S { fn a(&self) -> isize { 10 } } |
14 | impl B for S { fn b(&self) -> isize { 20 } } | |
15 | impl C for S { fn c(&self) -> isize { 30 } } | |
16 | impl D for S { fn d(&self) -> isize { 40 } } | |
223e47cc LB |
17 | |
18 | fn f<T:D>(x: &T) { | |
970d7e83 LB |
19 | assert_eq!(x.a(), 10); |
20 | assert_eq!(x.b(), 20); | |
21 | assert_eq!(x.c(), 30); | |
22 | assert_eq!(x.d(), 40); | |
223e47cc LB |
23 | } |
24 | ||
25 | pub fn main() { | |
26 | let value = &S { bogus: () }; | |
27 | f(value); | |
28 | } |