Implement IntoFuture type inference

This commit is contained in:
Justin Ridgewell 2022-08-08 20:20:45 -04:00
parent 3792720086
commit 5810c8188a
9 changed files with 75 additions and 22 deletions

View file

@ -471,6 +471,21 @@ pub mod future {
#[lang = "poll"]
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output>;
}
pub trait IntoFuture {
type Output;
type IntoFuture: Future<Output = Self::Output>;
#[lang = "into_future"]
fn into_future(self) -> Self::IntoFuture;
}
impl<F: Future> IntoFuture for F {
type Output = F::Output;
type IntoFuture = F;
fn into_future(self) -> F {
self
}
}
}
pub mod task {
pub enum Poll<T> {