Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Road to 1.0 #122

Closed
Veetaha opened this issue Aug 20, 2020 · 4 comments
Closed

Road to 1.0 #122

Veetaha opened this issue Aug 20, 2020 · 4 comments

Comments

@Veetaha
Copy link

Veetaha commented Aug 20, 2020

Hey, looks like the crate is mature enough for reaching 1.0. isn't it?

@taiki-e
Copy link
Contributor

taiki-e commented Sep 4, 2020

Before doing this, we might want to compare the current approach of expanding an async method into a normal method + async functions with the approach of expanding an async method into a normal method + an async block.
As far as I know (and if I remember correctly), the latter can solve existing problems such as #8, #61, and #126, but it can cause some other problems such as drop-order.

EDIT: As dtolnay said in #125 (review), a normal method + an async block is not preferable if it changes the drop order.

@jocutajar

This comment has been minimized.

@qm3ster
Copy link

qm3ster commented Apr 5, 2021

It is now CURRENT_YEAR, perhaps we can start preparing for min_type_alias_impl_trait? For example by having a nightly feature flag that generates code with associated types instead of Box<dyn?
Something like this:

#![feature(min_type_alias_impl_trait)]
use core::future::Future;
trait Trait<'async_lifetime> {
    type F: Future<Output = String>;
    fn ie(&'async_lifetime mut self) -> Self::F;
}
struct B(String);
struct C();
impl<'async_lifetime> Trait<'async_lifetime> for B {
    type F = impl Future<Output = String> + 'async_lifetime;
    fn ie(&'async_lifetime mut self) -> Self::F {
        async move { std::mem::take(&mut self.0) }
    }
}
impl<'async_lifetime> Trait<'async_lifetime> for C {
    type F = impl Future<Output = String> + 'async_lifetime;
    fn ie(&'async_lifetime mut self) -> Self::F {
        async { "traid".into() }
    }
}
#[tokio::main]
async fn main() {
    let mut b = B("asyng".into());
    println!("{}", Bepis::ie(&mut b).await);
    println!("{}", b.0);
    println!("{}", Bepis::ie(&mut C()).await);
}

(sorry if this makes no sense, I am not a scientist)


Edit: An authoritative source has informed me that this is garbage, because it makes the trait not dynable and pollutes every constraint site with the lifetime. Those are fine tradeoffs for personally me, but definitely makes this not a 1-to-1 impl swap.

@dtolnay
Copy link
Owner

dtolnay commented Mar 25, 2022

I think 0.1 accurately indicates the level of maturity of this crate for the foreseeable future, so I am closing this issue.

@dtolnay dtolnay closed this as completed Mar 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants