]>
Commit | Line | Data |
---|---|---|
2b03887a | 1 | // check-pass |
5099ac24 | 2 | // edition:2021 |
5099ac24 FG |
3 | |
4 | #![feature(type_alias_impl_trait)] | |
5099ac24 FG |
5 | |
6 | use std::future::Future; | |
2b03887a | 7 | use std::marker::PhantomData; |
5099ac24 FG |
8 | |
9 | trait Stream { | |
10 | type Item; | |
11 | } | |
12 | ||
2b03887a FG |
13 | struct Empty<T> { |
14 | _phantom: PhantomData<T>, | |
5099ac24 | 15 | } |
2b03887a FG |
16 | |
17 | impl<T> Stream for Empty<T> { | |
18 | type Item = T; | |
5099ac24 FG |
19 | } |
20 | ||
21 | trait X { | |
22 | type LineStream<'a, Repr>: Stream<Item = Repr> where Self: 'a; | |
2b03887a FG |
23 | type LineStreamFut<'a, Repr>: Future<Output = Self::LineStream<'a, Repr>> where Self: 'a; |
24 | fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr>; | |
5099ac24 FG |
25 | } |
26 | ||
27 | struct Y; | |
28 | ||
29 | impl X for Y { | |
30 | type LineStream<'a, Repr> = impl Stream<Item = Repr>; | |
2b03887a | 31 | type LineStreamFut<'a, Repr> = impl Future<Output = Self::LineStream<'a, Repr>>; |
5099ac24 | 32 | fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> { |
2b03887a | 33 | async { Empty { _phantom: PhantomData } } |
5099ac24 FG |
34 | } |
35 | } | |
36 | ||
37 | fn main() {} |