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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
// Repro for <https://github.com/rust-lang/rust/issues/82921#issue-825114180>.
//@ edition: 2021
//@ revisions: assumptions no_assumptions
//@[assumptions] compile-flags: -Zhigher-ranked-assumptions
//@[assumptions] check-pass
//@[no_assumptions] known-bug: #110338
use core::future::Future;
use core::marker::PhantomData;
use core::pin::Pin;
use core::task::{Context, Poll};
async fn f() {}
pub fn fail<'a>() -> Box<dyn Future<Output = ()> + Send + 'a> {
Box::new(async { new(|| async { f().await }).await })
}
fn new<A, B>(_a: A) -> F<A, B>
where
A: Fn() -> B,
{
F { _i: PhantomData }
}
trait Stream {
type Item;
}
struct T<A, B> {
_a: PhantomData<A>,
_b: PhantomData<B>,
}
impl<A, B> Stream for T<A, B>
where
A: Fn() -> B,
{
type Item = B;
}
struct F<A, B>
where
A: Fn() -> B,
{
_i: PhantomData<<T<A, B> as Stream>::Item>,
}
impl<A, B> Future for F<A, B>
where
A: Fn() -> B,
{
type Output = ();
fn poll(self: Pin<&mut Self>, _cx: &mut Context) -> Poll<Self::Output> {
unimplemented!()
}
}
fn main() {}
|