]> git.lizzy.rs Git - rust.git/blob - src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn.rs
Auto merge of #79945 - jackh726:existential_trait_ref, r=nikomatsakis
[rust.git] / src / test / ui / associated-types / associated-types-project-from-hrtb-in-fn.rs
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
6 pub trait Foo<T> {
7     type A;
8
9     fn get(&self, t: T) -> Self::A;
10 }
11
12 fn foo2<I : for<'x> Foo<&'x isize>>(
13     x: I::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
23 fn 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
30 fn 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
37 pub fn main() {}