|
1 |
| -// check-fail |
| 1 | +// check-pass |
2 | 2 | // edition:2021
|
3 |
| -// known-bug: #88908 |
4 |
| - |
5 |
| -// This should pass, but seems to run into a TAIT bug. |
6 | 3 |
|
7 | 4 | #![feature(type_alias_impl_trait)]
|
8 | 5 |
|
9 | 6 | use std::future::Future;
|
| 7 | +use std::marker::PhantomData; |
10 | 8 |
|
11 | 9 | trait Stream {
|
12 | 10 | type Item;
|
13 | 11 | }
|
14 | 12 |
|
15 |
| -struct Empty<T>(T); |
16 |
| -impl<T> Stream for Empty<T> { |
17 |
| - type Item = (); |
| 13 | +struct Empty<T> { |
| 14 | + _phantom: PhantomData<T>, |
18 | 15 | }
|
19 |
| -fn empty<T>() -> Empty<T> { |
20 |
| - todo!() |
| 16 | + |
| 17 | +impl<T> Stream for Empty<T> { |
| 18 | + type Item = T; |
21 | 19 | }
|
22 | 20 |
|
23 | 21 | trait X {
|
24 | 22 | 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>; |
| 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>; |
29 | 25 | }
|
30 | 26 |
|
31 | 27 | struct Y;
|
32 | 28 |
|
33 | 29 | impl X for Y {
|
34 | 30 | type LineStream<'a, Repr> = impl Stream<Item = Repr>;
|
35 |
| - |
36 |
| - type LineStreamFut<'a, Repr> = impl Future<Output = Self::LineStream<'a, Repr>> ; |
37 |
| - |
| 31 | + type LineStreamFut<'a, Repr> = impl Future<Output = Self::LineStream<'a, Repr>>; |
38 | 32 | fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> {
|
39 |
| - async {empty()} |
| 33 | + async { Empty { _phantom: PhantomData } } |
40 | 34 | }
|
41 | 35 | }
|
42 | 36 |
|
|
0 commit comments