Skip to content

Expand async drops during drop elaboration#156649

Open
cjgillot wants to merge 16 commits into
rust-lang:mainfrom
cjgillot:move-async-expand
Open

Expand async drops during drop elaboration#156649
cjgillot wants to merge 16 commits into
rust-lang:mainfrom
cjgillot:move-async-expand

Conversation

@cjgillot
Copy link
Copy Markdown
Contributor

Async drops implemented by #123948 are expanded in await loops inside StateTransform. I find this odd, as StateTransform is tasked with removing yields from MIR.

This PR moves this async drop -> loop transformation to drop elaboration.

The first few commits create many mir-opt tests to gauge the effect of following commits. I can easily trim those.
The next few commits are from #156422.
Then come a few commits performing elementary simplifications to drop elaboration code.

The most important commit is Expand async drops during drop elaboration. It performs the main change and attempts to document what I had to understand doing that.

The last commit is a cleanup.

This is a large PR, but most of the diff is in generated files. I can easily split them, each commit compiles and passes tests on its own.

cc @zetanumbers

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 16, 2026

This PR changes MIR

cc @oli-obk, @RalfJung, @JakobDegen, @vakaras

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri

This PR changes rustc_public

cc @oli-obk, @celinval, @ouz-a, @makai410

The Cranelift subtree was changed

cc @bjorn3

Some changes occurred to the CTFE machinery

cc @RalfJung, @oli-obk, @lcnr

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 16, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 16, 2026

r? @JohnTitor

rustbot has assigned @JohnTitor.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 73 candidates
  • Random selection from 16 candidates

@cjgillot cjgillot force-pushed the move-async-expand branch from 1ed6528 to 20114b0 Compare May 16, 2026 18:51
@bjorn3
Copy link
Copy Markdown
Member

bjorn3 commented May 16, 2026

Is there some relation to #156495 or would that PR be orthogonal to this one?

@rust-log-analyzer

This comment has been minimized.

@cjgillot
Copy link
Copy Markdown
Contributor Author

Is there some relation to #156495 or would that PR be orthogonal to this one?

It should be orthogonal.

@rust-log-analyzer

This comment has been minimized.

@zetanumbers
Copy link
Copy Markdown
Contributor

uuh
cc @azhogin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants