Matthias Krüger 536fc22917
Rollup merge of #119978 - compiler-errors:async-closure-captures, r=oli-obk
Move async closure parameters into the resultant closure's future eagerly

Move async closure parameters into the closure's resultant future eagerly.

Before, we used to desugar `async |p1, p2, ..| { body }` as `|p1, p2, ..| { || async { body } }`. Now, we desugar the above like `|p1, p2, ..| { async move { let p1 = p1; let p2 = p2; ... body } }`. This mirrors the same desugaring that `async fn` does with its parameter types, and the compiler literally uses the same code via a shared helper function.

This removes the necessity for E0708, since now expressions like `async |x: i32| { x }` will not give you confusing borrow errors.

This does *not* fix the case where async closures have self-borrows. This will come with a general implementation of async closures, which is still in the works.

r? oli-obk
2024-01-18 10:34:18 +01:00
..
2024-01-13 12:46:58 -05:00
2024-01-05 09:30:27 +00:00
2024-01-13 12:46:58 -05:00
2024-01-13 12:46:58 -05:00
2024-01-13 12:46:58 -05:00
2024-01-13 12:46:58 -05:00
2024-01-05 10:00:59 +00:00
2024-01-16 09:25:28 +01:00
2024-01-13 12:46:58 -05:00
2023-12-20 22:53:56 -05:00
2024-01-17 00:43:44 +00:00
2024-01-13 12:46:58 -05:00
2023-12-14 15:22:37 +01:00
2024-01-13 12:46:58 -05:00
2024-01-13 12:46:58 -05:00
2024-01-13 12:46:58 -05:00
2024-01-13 12:46:58 -05:00
2024-01-13 12:46:58 -05:00
2023-12-23 00:09:37 +08:00
2024-01-13 12:46:58 -05:00
2024-01-13 12:46:58 -05:00
2024-01-13 12:46:58 -05:00
2023-12-14 15:22:37 +01:00
2024-01-13 12:46:58 -05:00
2024-01-13 12:46:58 -05:00
2024-01-11 21:39:44 +08:00
2024-01-13 12:46:58 -05:00
2024-01-13 12:46:58 -05:00
2024-01-05 10:00:59 +00:00
2024-01-13 12:46:58 -05:00
2024-01-13 12:46:58 -05:00
2024-01-13 12:46:58 -05:00
2024-01-13 12:46:58 -05:00
2024-01-16 09:25:28 +01:00
2024-01-13 12:46:58 -05:00
2024-01-05 09:30:27 +00:00
2024-01-13 12:46:58 -05:00
2024-01-13 12:46:58 -05:00
2024-01-05 18:49:25 +01:00
2024-01-13 12:46:58 -05:00
2024-01-13 12:46:58 -05:00
2024-01-13 12:46:58 -05:00
2024-01-13 12:46:58 -05:00
2024-01-13 12:46:58 -05:00
2024-01-13 12:46:58 -05:00
2024-01-13 12:46:58 -05:00
2024-01-13 12:46:58 -05:00
2024-01-13 12:46:58 -05:00
2024-01-05 09:30:27 +00:00
2024-01-13 12:46:58 -05:00
2024-01-13 12:46:58 -05:00
2024-01-05 10:56:59 +00:00
2023-12-19 13:35:37 -05:00
2024-01-13 12:46:58 -05:00
2024-01-13 12:46:58 -05:00
2024-01-05 10:00:59 +00:00
2024-01-13 12:46:58 -05:00
2024-01-13 12:46:58 -05:00
2024-01-13 12:46:58 -05:00
2024-01-13 12:46:58 -05:00
2024-01-13 12:46:58 -05:00
2024-01-05 10:00:59 +00:00
2024-01-13 12:46:58 -05:00
2024-01-13 12:46:58 -05:00
2023-12-19 13:35:37 -05:00
2024-01-13 12:46:58 -05:00
2024-01-13 12:46:58 -05:00
2024-01-13 12:46:58 -05:00