]> git.lizzy.rs Git - rust.git/blob - tests/ui/generic-associated-types/issue-89008.rs
Auto merge of #106696 - kylematsuda:early-binder, r=lcnr
[rust.git] / tests / ui / generic-associated-types / issue-89008.rs
1 // check-pass
2 // edition:2021
3
4 #![feature(type_alias_impl_trait)]
5
6 use std::future::Future;
7 use std::marker::PhantomData;
8
9 trait Stream {
10     type Item;
11 }
12
13 struct Empty<T> {
14     _phantom: PhantomData<T>,
15 }
16
17 impl<T> Stream for Empty<T> {
18     type Item = T;
19 }
20
21 trait X {
22     type LineStream<'a, Repr>: Stream<Item = Repr> where Self: 'a;
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>;
25 }
26
27 struct Y;
28
29 impl X for Y {
30     type LineStream<'a, Repr> = impl Stream<Item = Repr>;
31     type LineStreamFut<'a, Repr> = impl Future<Output = Self::LineStream<'a, Repr>>;
32     fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> {
33         async { Empty { _phantom: PhantomData } }
34     }
35 }
36
37 fn main() {}