]>
Commit | Line | Data |
---|---|---|
94222f64 XL |
1 | // check-pass |
2 | ||
3 | use std::marker::PhantomData; | |
4 | ||
5 | trait Lt<'a> { | |
6 | type T; | |
7 | } | |
8 | struct Id<T>(PhantomData<T>); | |
9 | impl<'a,T> Lt<'a> for Id<T> { | |
10 | type T = T; | |
11 | } | |
12 | ||
13 | struct Ref<T>(PhantomData<T>) where T: ?Sized; | |
14 | impl<'a,T> Lt<'a> for Ref<T> | |
15 | where T: 'a + Lt<'a> + ?Sized | |
16 | { | |
17 | type T = &'a T; | |
18 | } | |
19 | struct Mut<T>(PhantomData<T>) where T: ?Sized; | |
20 | impl<'a,T> Lt<'a> for Mut<T> | |
21 | where T: 'a + Lt<'a> + ?Sized | |
22 | { | |
23 | type T = &'a mut T; | |
24 | } | |
25 | ||
26 | struct C<I,O>(for<'a> fn(<I as Lt<'a>>::T) -> O) where I: for<'a> Lt<'a>; | |
27 | ||
28 | ||
29 | fn main() { | |
30 | let c = C::<Id<_>,_>(|()| 3); | |
31 | c.0(()); | |
32 | ||
33 | } |