Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

My understanding is that `async fn` in a trait is desugared to `fn() -> impl Future` just like it would be anywhere else, so there's no unsized types involved.


It's actually desugared to a generic associated type:

    trait Foo {
        type bar_Returns<'s>: Future<Output = Result<u64, ()>>
        where Self: 's;

        fn bar<'s>(&'s self) -> Self::bar_Returns<'s>;
    }




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: