]> git.lizzy.rs Git - rust.git/blob - src/test/ui/associated-type-bounds/hrtb.rs
Auto merge of #103894 - mati865:gnullvm-libunwind-changes, r=thomcc
[rust.git] / src / test / ui / associated-type-bounds / hrtb.rs
1 // check-pass
2
3 #![feature(associated_type_bounds)]
4
5 trait A<'a> {}
6 trait B<'b> {}
7 fn foo<T>()
8 where
9     for<'a> T: A<'a> + 'a,
10 {
11 }
12 trait C<'c>: for<'a> A<'a> + for<'b> B<'b> {
13     type As;
14 }
15 struct D<T>
16 where
17     T: for<'c> C<'c, As: A<'c>>,
18 {
19     t: std::marker::PhantomData<T>,
20 }
21
22 trait E<'e> {
23     type As;
24 }
25 trait F<'f>: for<'a> A<'a> + for<'e> E<'e> {}
26 struct G<T>
27 where
28     for<'f> T: F<'f, As: E<'f>> + 'f,
29 {
30     t: std::marker::PhantomData<T>,
31 }
32
33 trait I<'a, 'b, 'c> {
34     type As;
35 }
36 trait H<'d, 'e>: for<'f> I<'d, 'f, 'e> + 'd {}
37 fn foo2<T>()
38 where
39     T: for<'g> H<'g, 'g, As: for<'h> H<'h, 'g> + 'g>,
40 {
41 }
42
43 fn foo3<T>()
44 where
45     T: for<'i> H<'i, 'i, As: for<'j> H<'j, 'i, As: for<'k> I<'i, 'k, 'j> + 'j> + 'i>,
46 {
47 }
48 fn foo4<T>()
49 where
50     T: for<'l, 'i> H<'l, 'i, As: for<'j> H<'j, 'i, As: for<'k> I<'l, 'k, 'j> + 'j> + 'i>,
51 {
52 }
53
54 struct X<'x, 'y> {
55     x: std::marker::PhantomData<&'x ()>,
56     y: std::marker::PhantomData<&'y ()>,
57 }
58
59 fn foo5<T>()
60 where
61     T: for<'l, 'i> H<'l, 'i, As: for<'j> H<'j, 'i, As: for<'k> H<'j, 'k, As = X<'j, 'k>> + 'j> + 'i>
62 {
63 }
64
65 fn main() {}