rust/library
bors 208dd2032b Auto merge of #118847 - eholk:for-await, r=compiler-errors
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 #118898 as the feature tracking issue.

r? `@compiler-errors`
2023-12-22 14:17:10 +00:00
..
alloc Auto merge of #106790 - the8472:rawvec-niche, r=scottmcm 2023-12-20 02:19:10 +00:00
backtrace@6145fe6bac Update backtrace submodule 2023-11-21 16:33:42 +01:00
core Auto merge of #118847 - eholk:for-await, r=compiler-errors 2023-12-22 14:17:10 +00:00
panic_abort add teeos std impl 2023-12-07 10:33:03 +08:00
panic_unwind panic_unwind: support unwinding on xous 2023-11-16 15:23:09 +08:00
portable-simd Fix target_feature config in portable-simd 2023-12-14 14:50:32 +01:00
proc_macro Add support for --env on tracked_env::var 2023-12-11 16:44:33 +01:00
profiler_builtins
rtstartup
rustc-std-workspace-alloc
rustc-std-workspace-core
rustc-std-workspace-std
std Rollup merge of #119051 - ChrisDenton:wine, r=workingjubilee 2023-12-18 08:08:24 +01:00
stdarch@f4528dd6e8
sysroot
test remove redundant imports 2023-12-10 10:56:22 +08:00
unwind unwind: add support for using unwinding crate 2023-11-16 15:23:09 +08:00