External Publication
Visit Post

[Discussion] Alternative syntax for async iteration: `for async i in stream`?

Rust Internals [Unofficial] May 2, 2026
Source

The await in for await is trying to suggest a very specific meaning: "there is a suspension point here, unwrapping a future (and possibly pausing execution)". Similarly, the async in async fn and the hypothetical async let [sic; a reference to a Swift feature rather than destructuring] has the opposite meaning: "there's an implicit async block here, wrapping computation into a future".

for async would make sense to me if you still have to i.await in the body of the loop…but if that were the case, how would the loop ever know when to terminate? Either something has to be awaited before the body begins, or the signature of next would need to be Option<Future<…>> rather than Future<Option<…>>, which would be less useful. So I think for await remains the correct choice.

Discussion in the ATmosphere

Loading comments...