rust/compiler/rustc_span/src
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
..
analyze_source_file Use relative positions inside a SourceFile. 2023-09-03 12:56:10 +00:00
edit_distance Add test for precise algorithm used 2023-02-19 22:59:22 +00:00
source_map rustc_span: Optimize syntax context comparisons 2024-01-06 01:25:20 +03:00
symbol Use FxIndexSet in the symbol interner. 2023-11-03 07:19:41 +11:00
analyze_source_file.rs Initiate the inner usage of cfg_match 2023-10-19 20:18:51 -03:00
caching_source_map_view.rs Add better ICE messages for some undescriptive panics 2023-12-15 00:50:55 -05:00
def_id.rs Auto merge of #119478 - bjorn3:no_serialize_specialization, r=wesleywiser 2024-01-06 09:56:00 +00:00
edit_distance.rs check rust lints when an unknown lint is detected 2024-01-12 18:50:36 +08:00
edition.rs Remove edition umbrella features. 2023-12-10 13:03:28 -08:00
fatal_error.rs Auto merge of #117557 - Zoxc:panic-prio, r=petrochenkov 2023-11-09 00:39:02 +00:00
hygiene.rs Add async bound modifier to enable async Fn bounds 2024-01-31 16:59:19 +00:00
lib.rs normalize_newlines(): fix incorrect comment 2024-01-28 19:30:41 +00:00
profiling.rs Remove an unnecessary use of with_session_globals. 2023-03-31 15:34:00 +11:00
source_map.rs Use UnhashMap for a few more maps 2024-01-17 17:09:55 -05:00
span_encoding.rs rustc_span: Optimize syntax context comparisons 2024-01-06 01:25:20 +03:00
symbol.rs Auto merge of #120361 - compiler-errors:async-closures, r=oli-obk 2024-02-06 15:04:01 +00:00
tests.rs Use Freeze for SourceFile.lines 2023-09-07 13:05:05 +02:00