async fn drop order for temporaries in return expression does not match sync #64512
Labels
A-async-await
Area: Async & Await
AsyncAwait-Polish
Async-await issues that are part of the "polish" area
P-high
High priority
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
T-lang
Relevant to the language team, which will review and decide on the PR/issue.
This asynchronous function:
will drop first y, then x, then the temporary D. However an equivalent synchronous function (playground) would drop the temporary, then y, then x. The problem is our desugaring for async fn, which looks something like this:
here, the temporaries in
$body
wind up being dropped after the let-bound variables of the block. Proposed fix in a comment below.The text was updated successfully, but these errors were encountered: