1 // Annnotations may contain projection types with inference variables as input.
2 // Make sure we don't get ambiguities when normalizing them.
7 fn test1<A, B, C, D>(a: A, b: B, c: C) {
9 impl<T: 'static> Tr for (T,) { type Ty = T; }
11 let _: <(_,) as Tr>::Ty = a; //~ ERROR type `A`
12 Some::<<(_,) as Tr>::Ty>(b); //~ ERROR type `B`
13 || -> <(_,) as Tr>::Ty { c }; //~ ERROR type `C`
14 |d: <(_,) as Tr>::Ty| -> D { d }; //~ ERROR type `D`
18 // Two impls. The selected impl depends on the actual type.
19 fn test2<A, B, C>(a: A, b: B, c: C) {
21 impl<T: 'static> Tr for (u8, T) { type Ty = T; }
22 impl<T> Tr for (i8, T) { type Ty = T; }
23 type Alias<X, Y> = (<(X, Y) as Tr>::Ty, X);
25 fn temp() -> String { todo!() }
27 // `u8` impl, requires static.
28 let _: Alias<_, _> = (a, 0u8); //~ ERROR type `A`
29 Some::<Alias<_, _>>((b, 0u8)); //~ ERROR type `B`
30 || -> Alias<_, _> { (c, 0u8) }; //~ ERROR type `C`
32 let _: Alias<_, _> = (&temp(), 0u8); //~ ERROR temporary value
33 Some::<Alias<_, _>>((&temp(), 0u8)); //~ ERROR temporary value
35 // `i8` impl, no region constraints.
36 let _: Alias<_, _> = (&temp(), 0i8);
37 Some::<Alias<_, _>>((&temp(), 0i8));