Elektrine lite

← Feed

@chrysn@chaos.social

Post #2028353

2026-05-04 18:06 UTC

@diondokter Could an async fn / block waive the "does not do anything until polled" guarantee? (Like `#[allow_eager_parts]`. Ideally, this might even become default in a future edition). The only reason I see for this guarantee to be there is so that all the inner parts can be pinned, but then *if* anything relevant is not Unpin, the compiler could still go into the old mode.

Replies (1)

  • @diondokter@fosstodon.org 2026-05-04 19:31

    @chrysn Could? Well yes of course in the literal sense of the word. Futures have surprisingly few guarantees, so them being lazy is one of the only ones. If I were to guess, you would not get consensus on this. Luckily you can do it manually fairly easily: fn foo() -> impl Future { // Eager sync stuff ... async { // Deferred async stuff ... } }

    Open ##2028354