]> git.lizzy.rs Git - rust.git/blob - src/test/ui/generic-associated-types/bugs/issue-89008.rs
012aa8df2fc3fcca58d5acfe34743e04cf9b924f
[rust.git] / src / test / ui / generic-associated-types / bugs / issue-89008.rs
1 // check-fail
2 // edition:2021
3 // known-bug: #88908
4
5 // This should pass, but seems to run into a TAIT bug.
6
7 #![feature(type_alias_impl_trait)]
8
9 use std::future::Future;
10
11 trait Stream {
12     type Item;
13 }
14
15 struct Empty<T>(T);
16 impl<T> Stream for Empty<T> {
17     type Item = ();
18 }
19 fn empty<T>() -> Empty<T> {
20     todo!()
21 }
22
23 trait X {
24     type LineStream<'a, Repr>: Stream<Item = Repr> where Self: 'a;
25
26     type LineStreamFut<'a,Repr>: Future<Output = Self::LineStream<'a, Repr>> where Self: 'a;
27
28     fn line_stream<'a,Repr>(&'a self) -> Self::LineStreamFut<'a,Repr>;
29 }
30
31 struct Y;
32
33 impl X for Y {
34     type LineStream<'a, Repr> = impl Stream<Item = Repr>;
35
36     type LineStreamFut<'a, Repr> = impl Future<Output = Self::LineStream<'a, Repr>> ;
37
38     fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> {
39         async {empty()}
40     }
41 }
42
43 fn main() {}