1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
// run-pass trait A { fn g<T>(&self, x: T, y: T) -> (T, T) { (x, y) } } impl A for isize { } fn f<T, V: A>(i: V, j: T, k: T) -> (T, T) { i.g(j, k) } pub fn main () { assert_eq!(f(0, 1, 2), (1, 2)); assert_eq!(f(0, 1u8, 2u8), (1u8, 2u8)); }