rust/library
bors 4a2fe4491e Auto merge of #120361 - compiler-errors:async-closures, r=oli-obk
Rework support for async closures; allow them to return futures that borrow from the closure's captures

This PR implements a new lowering for async closures via `TyKind::CoroutineClosure` which handles the curious relationship between the closure and the coroutine that it returns.

I wrote up a bunch in [this hackmd](https://hackmd.io/`@compiler-errors/S1HvqQxca)` which will be copied to the dev guide after this PR lands, and hopefully left sufficient comments in the source code explaining why this change is as large as it is.

This also necessitates that they begin implementing the `AsyncFn`-family of traits, rather than the `Fn`-family of traits -- if you need `Fn` implementations, you should probably use the non-sugar `|| async {}` syntax instead.

Notably this PR does not yet implement `async Fn()` syntax sugar for bounds, but I expect to add those soon (**edit:** #120392). For now, users must use `AsyncFn()` traits directly, which necessitates adding the `async_fn_traits` feature gate as well. I will add this as a follow-up very soon.

r? oli-obk

This is based on top of #120322, but that PR is minimal.
2024-02-06 15:04:01 +00:00
..
alloc Rollup merge of #118960 - tvallotton:local_waker, r=Mark-Simulacrum 2024-02-05 11:07:26 +01:00
backtrace@6145fe6bac
core Bless tests, add comments 2024-02-06 02:22:58 +00:00
panic_abort
panic_unwind
portable-simd Disable conversions between portable_simd and stdarch on big-endian ARM 2024-01-30 04:47:01 +00:00
proc_macro
profiler_builtins
rtstartup
rustc-std-workspace-alloc
rustc-std-workspace-core
rustc-std-workspace-std
std Auto merge of #117372 - Amanieu:stdarch_update, r=Mark-Simulacrum 2024-02-05 15:41:40 +00:00
stdarch@5ef6eb42bd Update stdarch submodule 2024-01-30 03:33:12 +00:00
sysroot
test Actually abort in panic-abort-tests 2024-01-30 18:19:49 -08:00
unwind