1 #![allow(dead_code)] 2 // run-rustfix 3 // Check projection of an associated type out of a higher-ranked trait-bound 4 // in the context of a method definition in a trait. 5 6 pub trait Foo<T> { 7 type A; 8 get(&self, t: T) -> Self::A9 fn get(&self, t: T) -> Self::A; 10 } 11 12 trait SomeTrait<I : for<'x> Foo<&'x isize>> { some_method(&self, arg: I::A)13 fn some_method(&self, arg: I::A); 14 //~^ ERROR cannot use the associated type of a trait with uninferred generic parameters 15 } 16 17 trait AnotherTrait<I : for<'x> Foo<&'x isize>> { some_method(&self, arg: <I as Foo<&isize>>::A)18 fn some_method(&self, arg: <I as Foo<&isize>>::A); 19 } 20 21 trait YetAnotherTrait<I : for<'x> Foo<&'x isize>> { some_method<'a>(&self, arg: <I as Foo<&'a isize>>::A)22 fn some_method<'a>(&self, arg: <I as Foo<&'a isize>>::A); 23 } 24 25 trait Banana<'a> { 26 type Assoc: Default; 27 } 28 29 struct Peach<X>(std::marker::PhantomData<X>); 30 31 impl<X: for<'a> Banana<'a>> Peach<X> { mango(&self) -> X::Assoc32 fn mango(&self) -> X::Assoc { 33 //~^ ERROR cannot use the associated type of a trait with uninferred generic parameters 34 Default::default() 35 } 36 } 37 main()38pub fn main() {} 39