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 Update backtrace submodule 2023-11-21 16:33:42 +01:00
core Bless tests, add comments 2024-02-06 02:22:58 +00:00
panic_abort rustc: implement support for riscv32im_risc0_zkvm_elf 2024-01-22 10:07:36 -08:00
panic_unwind Update test for E0796 and static_mut_ref lint 2024-01-07 17:29:25 +03:00
portable-simd Disable conversions between portable_simd and stdarch on big-endian ARM 2024-01-30 04:47:01 +00:00
proc_macro Document Token{Stream,Tree}::Display more thoroughly. 2024-01-22 13:31:52 +11:00
profiler_builtins Bump cfg(bootstrap) 2023-08-23 20:05:14 -04:00
rtstartup library: Fix warnings in rtstartup 2024-01-06 01:32:03 +03:00
rustc-std-workspace-alloc Replace libstd, libcore, liballoc in line comments. 2022-12-30 14:00:42 +01:00
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 Expose compiler-builtins-weak-intrinsics feature for -Zbuild-std 2023-06-23 11:15:34 +01:00
test Actually abort in panic-abort-tests 2024-01-30 18:19:49 -08:00
unwind Enable Static Builds for FreeBSD 2024-01-11 15:26:16 +00:00