about summary refs log tree commit diff
path: root/tests/ui/associated-type-bounds/nested-gat-projection.rs
blob: ad37da9ed19488f9f09873278f95d2eecf443d0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//@ check-pass

trait Trait
where
    for<'a> Self::Gat<'a>: OtherTrait,
    for<'a, 'b, 'c> <Self::Gat<'a> as OtherTrait>::OtherGat<'b>: HigherRanked<'c>,
{
    type Gat<'a>;
}

trait OtherTrait {
    type OtherGat<'b>;
}

trait HigherRanked<'c> {}

fn lower_ranked<T: for<'b, 'c> OtherTrait<OtherGat<'b>: HigherRanked<'c>>>() {}

fn higher_ranked<T: Trait>()
where
    for<'a> T::Gat<'a>: OtherTrait,
    for<'a, 'b, 'c> <T::Gat<'a> as OtherTrait>::OtherGat<'b>: HigherRanked<'c>,
{
}

fn test<T: Trait>() {
    lower_ranked::<T::Gat<'_>>();
    higher_ranked::<T>();
}

fn main() {}