diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-01-18 10:34:18 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-18 10:34:18 +0100 |
| commit | cc629f0a1e753423eee0bbb60254ccd82c7a2892 (patch) | |
| tree | 045ecce990748780206c61e6d25ee011471971cc /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp | |
| parent | 33e1e6f783cb3a725f2ff0f134400031890d6f7f (diff) | |
| parent | f7376a0f8cc4177955e01d88e56aabbfd635a566 (diff) | |
| download | rust-cc629f0a1e753423eee0bbb60254ccd82c7a2892.tar.gz rust-cc629f0a1e753423eee0bbb60254ccd82c7a2892.zip | |
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
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
