4 // This is a regression test for https://github.com/rust-lang/rust/issues/105501.
5 // It was minified from the published `msf-ice:0.2.1` crate which failed in a crater run.
6 // A faulty compiler was triggering a `higher-ranked lifetime error`:
8 // > could not prove `[async block@...]: Send`
10 use mini_futures::Stream;
12 fn is_send(_: impl Send) {}
16 let mut stream = mini_futures::iter([()])
18 .map(|_| async { None })
20 .filter_map(std::future::ready);
26 let _: Option<()> = fut.await;
30 // this is a simplified subset of `futures::StreamExt` and related types
32 use std::future::Future;
34 use std::task::{Context, Poll};
36 pub fn iter<I>(_: I) -> Iter<I::IntoIter>
46 fn then<Fut, F>(self, _: F) -> Then<Self, Fut, F>
48 F: FnMut(Self::Item) -> Fut,
55 fn map<T, F>(self, _: F) -> Map<Self, F>
57 F: FnMut(Self::Item) -> T,
63 fn buffered(self) -> Buffered<Self>
71 fn filter_map<Fut, T, F>(self, _: F) -> FilterMap<Self, Fut, F>
73 F: FnMut(Self::Item) -> Fut,
74 Fut: Future<Output = Option<T>>,
80 fn next(&mut self) -> Next<'_, Self> {
88 impl<I> Stream for Iter<I>
95 pub struct Then<St, Fut, F> {
98 impl<St, Fut, F> Stream for Then<St, Fut, F>
101 F: FnMut(St::Item) -> Fut,
104 type Item = Fut::Output;
107 pub struct Map<St, F> {
110 impl<St, F> Stream for Map<St, F>
115 type Item = F::Output;
118 pub trait FnMut1<A> {
121 impl<T, A, R> FnMut1<A> for T
128 pub struct Buffered<St>
135 impl<St> Stream for Buffered<St>
140 type Item = <St::Item as Future>::Output;
143 pub struct FilterMap<St, Fut, F> {
146 impl<St, Fut, F, T> Stream for FilterMap<St, Fut, F>
149 F: FnMut1<St::Item, Output = Fut>,
150 Fut: Future<Output = Option<T>>,
155 pub struct Next<'a, St: ?Sized> {
158 impl<St: ?Sized + Stream> Future for Next<'_, St> {
159 type Output = Option<St::Item>;
161 fn poll(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll<Self::Output> {