-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Tracking Issue for for await
loops
#118898
Labels
B-experimental
Blocker: In-tree experiment; RFC pending, not yet approved or unneeded.
B-unstable
Blocker: Implemented in the nightly compiler and unstable.
C-tracking-issue
Category: An issue tracking the progress of sth. like the implementation of an RFC
F-async_for_loop
`#![feature(async_for_loop)]`
T-lang
Relevant to the language team, which will review and decide on the PR/issue.
WG-async
Working group: Async & await
Comments
eholk
added
the
C-tracking-issue
Category: An issue tracking the progress of sth. like the implementation of an RFC
label
Dec 13, 2023
cc @rust-lang/wg-async |
fmease
added
the
T-lang
Relevant to the language team, which will review and decide on the PR/issue.
label
Dec 13, 2023
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Dec 20, 2023
Add support for `for await` loops This adds support for `for await` loops. This includes parsing, desugaring in AST->HIR lowering, and adding some support functions to the library. Given a loop like: ```rust for await i in iter { ... } ``` this is desugared to something like: ```rust let mut iter = iter.into_async_iter(); while let Some(i) = loop { match core::pin::Pin::new(&mut iter).poll_next(cx) { Poll::Ready(i) => break i, Poll::Pending => yield, } } { ... } ``` This PR also adds a basic `IntoAsyncIterator` trait. This is partly for symmetry with the way `Iterator` and `IntoIterator` work. The other reason is that for async iterators it's helpful to have a place apart from the data structure being iterated over to store state. `IntoAsyncIterator` gives us a good place to do this. I've gated this feature behind `async_for_loop` and opened rust-lang#118898 as the feature tracking issue. r? `@compiler-errors`
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Dec 22, 2023
Add support for `for await` loops This adds support for `for await` loops. This includes parsing, desugaring in AST->HIR lowering, and adding some support functions to the library. Given a loop like: ```rust for await i in iter { ... } ``` this is desugared to something like: ```rust let mut iter = iter.into_async_iter(); while let Some(i) = loop { match core::pin::Pin::new(&mut iter).poll_next(cx) { Poll::Ready(i) => break i, Poll::Pending => yield, } } { ... } ``` This PR also adds a basic `IntoAsyncIterator` trait. This is partly for symmetry with the way `Iterator` and `IntoIterator` work. The other reason is that for async iterators it's helpful to have a place apart from the data structure being iterated over to store state. `IntoAsyncIterator` gives us a good place to do this. I've gated this feature behind `async_for_loop` and opened rust-lang#118898 as the feature tracking issue. r? `@compiler-errors`
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Dec 22, 2023
Add support for `for await` loops This adds support for `for await` loops. This includes parsing, desugaring in AST->HIR lowering, and adding some support functions to the library. Given a loop like: ```rust for await i in iter { ... } ``` this is desugared to something like: ```rust let mut iter = iter.into_async_iter(); while let Some(i) = loop { match core::pin::Pin::new(&mut iter).poll_next(cx) { Poll::Ready(i) => break i, Poll::Pending => yield, } } { ... } ``` This PR also adds a basic `IntoAsyncIterator` trait. This is partly for symmetry with the way `Iterator` and `IntoIterator` work. The other reason is that for async iterators it's helpful to have a place apart from the data structure being iterated over to store state. `IntoAsyncIterator` gives us a good place to do this. I've gated this feature behind `async_for_loop` and opened rust-lang#118898 as the feature tracking issue. r? `@compiler-errors`
flip1995
pushed a commit
to flip1995/rust
that referenced
this issue
Dec 28, 2023
Add support for `for await` loops This adds support for `for await` loops. This includes parsing, desugaring in AST->HIR lowering, and adding some support functions to the library. Given a loop like: ```rust for await i in iter { ... } ``` this is desugared to something like: ```rust let mut iter = iter.into_async_iter(); while let Some(i) = loop { match core::pin::Pin::new(&mut iter).poll_next(cx) { Poll::Ready(i) => break i, Poll::Pending => yield, } } { ... } ``` This PR also adds a basic `IntoAsyncIterator` trait. This is partly for symmetry with the way `Iterator` and `IntoIterator` work. The other reason is that for async iterators it's helpful to have a place apart from the data structure being iterated over to store state. `IntoAsyncIterator` gives us a good place to do this. I've gated this feature behind `async_for_loop` and opened rust-lang#118898 as the feature tracking issue. r? `@compiler-errors`
fmease
added
B-unstable
Blocker: Implemented in the nightly compiler and unstable.
F-async_for_loop
`#![feature(async_for_loop)]`
B-experimental
Blocker: In-tree experiment; RFC pending, not yet approved or unneeded.
labels
Feb 28, 2024
calebcartwright
pushed a commit
to calebcartwright/rust
that referenced
this issue
Jun 22, 2024
Add support for `for await` loops This adds support for `for await` loops. This includes parsing, desugaring in AST->HIR lowering, and adding some support functions to the library. Given a loop like: ```rust for await i in iter { ... } ``` this is desugared to something like: ```rust let mut iter = iter.into_async_iter(); while let Some(i) = loop { match core::pin::Pin::new(&mut iter).poll_next(cx) { Poll::Ready(i) => break i, Poll::Pending => yield, } } { ... } ``` This PR also adds a basic `IntoAsyncIterator` trait. This is partly for symmetry with the way `Iterator` and `IntoIterator` work. The other reason is that for async iterators it's helpful to have a place apart from the data structure being iterated over to store state. `IntoAsyncIterator` gives us a good place to do this. I've gated this feature behind `async_for_loop` and opened rust-lang#118898 as the feature tracking issue. r? `@compiler-errors`
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
B-experimental
Blocker: In-tree experiment; RFC pending, not yet approved or unneeded.
B-unstable
Blocker: Implemented in the nightly compiler and unstable.
C-tracking-issue
Category: An issue tracking the progress of sth. like the implementation of an RFC
F-async_for_loop
`#![feature(async_for_loop)]`
T-lang
Relevant to the language team, which will review and decide on the PR/issue.
WG-async
Working group: Async & await
This is a tracking issue for a
for await
loop variant that makes it easier to work with async iterators (#79024).The feature gate for the issue is
#![feature(async_for_loop)]
.About tracking issues
Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
Steps
Dependencies
AsyncIterator
still doesn't have consensus, and naturally the desugaring offor await
will depend on this. Fortunately, the desugaring is an implementation detail so we aren't necessarily blocked on experimentation by that design.Unresolved Questions
This is an early experimental feature, so basically every question is still unresolved.
Implementation history
for await
loops #118847The text was updated successfully, but these errors were encountered: