1 // compile-flags: -Zdrop-tracking
6 use std::marker::PhantomData;
10 fn send<T: Send>(_: T) {}
15 fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>>;
18 struct Empty<T>(PhantomData<fn() -> T>);
20 impl<T> Stream for Empty<T> {
23 fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
28 pub trait FnOnce1<A> {
30 fn call_once(self, arg: A) -> Self::Output;
33 impl<T, A, R> FnOnce1<A> for T
38 fn call_once(self, arg: A) -> R {
43 pub trait FnMut1<A>: FnOnce1<A> {
44 fn call_mut(&mut self, arg: A) -> Self::Output;
47 impl<T, A, R> FnMut1<A> for T
51 fn call_mut(&mut self, arg: A) -> R {
56 struct Map<St, F>(St, F);
58 impl<St, F> Stream for Map<St, F>
63 type Item = F::Output;
65 fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
70 struct FuturesOrdered<T: Future>(PhantomData<fn() -> T::Output>);
72 pub struct Buffered<St: Stream>(St, FuturesOrdered<St::Item>, usize)
76 impl<St> Stream for Buffered<St>
81 type Item = <St::Item as Future>::Output;
83 fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
88 struct Next<'a, T: ?Sized>(&'a T);
90 impl<St: ?Sized + Stream + Unpin> Future for Next<'_, St> {
91 type Output = Option<St::Item>;
93 fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
100 //~^ ERROR implementation of `FnOnce` is not general enough
101 //~| ERROR implementation of `FnOnce` is not general enough
102 //~| ERROR implementation of `FnOnce` is not general enough
103 //~| ERROR implementation of `FnOnce` is not general enough
104 Next(&Buffered(Map(Empty(PhantomData), ready::<&()>), FuturesOrdered(PhantomData), 0)).await