rust/tests
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
..
assembly
auxiliary
codegen
codegen-units
coverage coverage: Make unexpansion of closure bodies more precise 2024-02-05 10:09:46 +11:00
coverage-run-rustdoc
debuginfo
incremental
mir-opt Fix drop shim for AsyncFnOnce closure, AsyncFnMut shim for AsyncFn closure 2024-02-06 02:22:58 +00:00
pretty
run-make
run-make-fulldeps
run-pass-valgrind
rustdoc
rustdoc-gui
rustdoc-js
rustdoc-js-std
rustdoc-json
rustdoc-ui Rollup merge of #116284 - RalfJung:no-nan-match, r=cjgillot 2024-02-05 11:07:26 +01:00
ui Auto merge of #120361 - compiler-errors:async-closures, r=oli-obk 2024-02-06 15:04:01 +00:00
ui-fulldeps Add CoroutineClosure to TyKind, AggregateKind, UpvarArgs 2024-02-06 02:22:58 +00:00
COMPILER_TESTS.md