This commit is contained in:
nora 2025-10-17 22:21:28 +02:00
commit 93553d8aae
10 changed files with 218 additions and 0 deletions

62
src/main.rs Normal file
View file

@ -0,0 +1,62 @@
use futures_util::future::{Map, MapOk};
use std::pin::Pin;
struct MapOk2<Fut, F>(Fut, F);
impl<Fut, F> Future for MapOk2<Fut, F>
where
Map<Fut, F>: Future,
{
type Output = <Map<Fut, F> as Future>::Output;
fn poll(
self: Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Self::Output> {
loop {}
}
}
pub struct MaybeDone<Fut: Future>(Fut);
pub fn take_output<Fut: Future>(x: Pin<&mut MaybeDone<Fut>>) -> Fut::Output {
loop {}
}
struct AndThen<Fut1, F>(Fut1, F);
impl<Fut1, F> Future for AndThen<Fut1, F>
where
MapOk<Fut1, F>: Future,
{
type Output = ();
fn poll(
self: Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Self::Output> {
loop {}
}
}
fn and_then<This, F>(s: This, f: F) -> AndThen<This, F> {
loop {}
}
pub async fn bar_baz() {
let bazz = and_then(async { Ok::<(), ()>(()) }, async |_| Ok::<(), ()>(()));
let barr = async { Bazz {} };
let mut _fut0 = MaybeDone(bazz);
let mut _fut0 = unsafe { std::pin::Pin::new_unchecked(&mut _fut0) };
let mut _fut1 = MaybeDone(barr);
let mut _fut1 = unsafe { std::pin::Pin::new_unchecked(&mut _fut1) };
std::future::poll_fn(move |__cx: &mut std::task::Context<'_>| {
std::task::Poll::Ready((take_output(_fut0.as_mut()), take_output(_fut1.as_mut())))
});
}
// 1
// 2
#[derive(proc_macro_thing::MyMacro)]
#[helper]
pub struct Bazz {}
fn main() {}