]> git.proxmox.com Git - rustc.git/blame - src/test/ui/generic-associated-types/issue-89008.rs
New upstream version 1.66.0+dfsg1
[rustc.git] / src / test / ui / generic-associated-types / issue-89008.rs
CommitLineData
2b03887a 1// check-pass
5099ac24 2// edition:2021
5099ac24
FG
3
4#![feature(type_alias_impl_trait)]
5099ac24
FG
5
6use std::future::Future;
2b03887a 7use std::marker::PhantomData;
5099ac24
FG
8
9trait Stream {
10 type Item;
11}
12
2b03887a
FG
13struct Empty<T> {
14 _phantom: PhantomData<T>,
5099ac24 15}
2b03887a
FG
16
17impl<T> Stream for Empty<T> {
18 type Item = T;
5099ac24
FG
19}
20
21trait 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
27struct Y;
28
29impl 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
37fn main() {}