1 // run-pass 2 // Test equality constraints on associated types in a where clause. 3 4 // pretty-expanded FIXME #23616 5 6 pub trait Foo { 7 type A; boo(&self) -> <Self as Foo>::A8 fn boo(&self) -> <Self as Foo>::A; 9 } 10 11 #[derive(PartialEq)] 12 pub struct Bar; 13 14 impl Foo for isize { 15 type A = usize; boo(&self) -> usize16 fn boo(&self) -> usize { 42 } 17 } 18 19 impl Foo for char { 20 type A = Bar; boo(&self) -> Bar21 fn boo(&self) -> Bar { Bar } 22 } 23 foo_bar<I: Foo<A=Bar>>(x: I) -> Bar24fn foo_bar<I: Foo<A=Bar>>(x: I) -> Bar { 25 x.boo() 26 } 27 foo_uint<I: Foo<A=usize>>(x: I) -> usize28fn foo_uint<I: Foo<A=usize>>(x: I) -> usize { 29 x.boo() 30 } 31 main()32pub fn main() { 33 let a = 42; 34 foo_uint(a); 35 36 let a = 'a'; 37 foo_bar(a); 38 } 39