summaryrefslogtreecommitdiffstats
path: root/src/test/ui/generic-associated-types/bugs/issue-89008.rs
blob: 79c28b0d22172007dbc8ad81bdaceb70a46823c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// check-fail
// edition:2021
// known-bug: #88908

// This should pass, but seems to run into a TAIT bug.

#![feature(type_alias_impl_trait)]
#![feature(generic_associated_types)]

use std::future::Future;

trait Stream {
    type Item;
}

struct Empty<T>(T);
impl<T> Stream for Empty<T> {
    type Item = ();
}
fn empty<T>() -> Empty<T> {
    todo!()
}

trait X {
    type LineStream<'a, Repr>: Stream<Item = Repr> where Self: 'a;

    type LineStreamFut<'a,Repr>: Future<Output = Self::LineStream<'a, Repr>> where Self: 'a;

    fn line_stream<'a,Repr>(&'a self) -> Self::LineStreamFut<'a,Repr>;
}

struct Y;

impl X for Y {
    type LineStream<'a, Repr> = impl Stream<Item = Repr>;

    type LineStreamFut<'a, Repr> = impl Future<Output = Self::LineStream<'a, Repr>> ;

    fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> {
        async {empty()}
    }
}

fn main() {}