1#![allow(dead_code, unused_variables)] 2// run-rustfix 3// Check projection of an associated type out of a higher-ranked trait-bound 4// in the context of a function signature. 5 6pub trait Foo<T> { 7 type A; 8 9 fn get(&self, t: T) -> Self::A; 10} 11 12fn foo2<I : for<'x> Foo<&'x isize>>( 13 x: <I as Foo<&isize>>::A) 14 //~^ ERROR cannot use the associated type of a trait with uninferred generic parameters 15{ 16 // This case is illegal because we have to instantiate `'x`, and 17 // we don't know what region to instantiate it with. 18 // 19 // This could perhaps be made equivalent to the examples below, 20 // specifically for fn signatures. 21} 22 23fn foo3<I : for<'x> Foo<&'x isize>>( 24 x: <I as Foo<&isize>>::A) 25{ 26 // OK, in this case we spelled out the precise regions involved, though we left one of 27 // them anonymous. 28} 29 30fn foo4<'a, I : for<'x> Foo<&'x isize>>( 31 x: <I as Foo<&'a isize>>::A) 32{ 33 // OK, in this case we spelled out the precise regions involved. 34} 35 36 37pub fn main() {} 38