.await
accepts IntoFuture
; could async
produce IntoFuture
s which aren't Future
s yet? Is this something which even could happen over an edition? Almost certainly not for the 2024 edition, but maybe for a future edition? From a strictly technical standpoint, it could, since async
is a language keyword feature, but I'm more interested in the social/ecosystem costs.
I understand the semantics-preserving migration lint would be fairly nightmarish (either lose async fn
sugar entirely or hide it behind a proc macro (which could probably just override the edition of the async
token)). I know existing ecosystem stuff mostly uses impl Future
and not IntoFuture
(cf. use of [Into
]Iterator
). But if we do want to push people towards using IntoFuture
more, the longer we wait the harder it gets. The absolute latest such a migration could happen would be when std exposes an async fn
.
The benefit of such a migration is that || async { … }
is smaller than async { … }
— it only has to store any captures, not also have space for the unstarted state machine. There are also alleged benefits from IntoFuture
benefiting from RVO (move elision) more often than passing around impl Future
does. (A minor pedagogical benefit: if async fn
returns IntoFuture
, it can't've been eagerly started. Potential technical benefit: hanging -> dyn Future
dynamic storage-agnostic spawn functionality off of IntoFuture
.)
At a minimum, it'd be nice to have || async { … }
be IntoFuture
.