Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not call query to compute coroutine layout for synthetic body of async closure #129847

Merged
merged 1 commit into from
Sep 8, 2024

Conversation

compiler-errors
Copy link
Member

There is code in the MIR validator that attempts to prevent query cycles when inlining a coroutine into itself, and will use the coroutine layout directly from the body when it detects that's the same coroutine as the one that's being validated. After #128506, this logic didn't take into account the fact that the coroutine def id will differ if it's the "by-move body" of an async closure. This PR implements that.

Fixes #129811

@rustbot
Copy link
Collaborator

rustbot commented Sep 1, 2024

r? @davidtwco

rustbot has assigned @davidtwco.
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

@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 Sep 1, 2024
@rustbot
Copy link
Collaborator

rustbot commented Sep 1, 2024

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@rust-log-analyzer

This comment has been minimized.

@davidtwco
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Sep 6, 2024

📌 Commit 384aed8 has been approved by davidtwco

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 6, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 7, 2024
…iaskrgr

Rollup of 10 pull requests

Successful merges:

 - rust-lang#126452 (Implement raw lifetimes and labels (`'r#ident`))
 - rust-lang#129555 (stabilize const_float_bits_conv)
 - rust-lang#129594 (explain the options bootstrap passes to curl)
 - rust-lang#129677 (Don't build by-move body when async closure is tainted)
 - rust-lang#129847 (Do not call query to compute coroutine layout for synthetic body of async closure)
 - rust-lang#129869 (add a few more crashtests)
 - rust-lang#130009 (rustdoc-search: allow trailing `Foo ->` arg search)
 - rust-lang#130046 (str: make as_mut_ptr and as_bytes_mut unstably const)
 - rust-lang#130047 (Win: Add dbghelp to the list of import libraries)
 - rust-lang#130059 (Remove the unused  `llvm-skip-rebuild` option from x.py)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 7b7f2f7 into rust-lang:master Sep 8, 2024
6 checks passed
@rustbot rustbot added this to the 1.83.0 milestone Sep 8, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Sep 8, 2024
Rollup merge of rust-lang#129847 - compiler-errors:async-cycle, r=davidtwco

Do not call query to compute coroutine layout for synthetic body of async closure

There is code in the MIR validator that attempts to prevent query cycles when inlining a coroutine into itself, and will use the coroutine layout directly from the body when it detects that's the same coroutine as the one that's being validated. After rust-lang#128506, this logic didn't take into account the fact that the coroutine def id will differ if it's the "by-move body" of an async closure. This PR implements that.

Fixes rust-lang#129811
Zalathar added a commit to Zalathar/rust that referenced this pull request Sep 14, 2024
Don't call closure_by_move_body_def_id on FnOnce async closures in MIR validation

Refactors the check in rust-lang#129847 to not unncessarily call the `closure_by_move_body_def_id` query for async closures that don't *need* a by-move body.

Fixes rust-lang#130167
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Sep 14, 2024
Rollup merge of rust-lang#130199 - compiler-errors:by-move, r=cjgillot

Don't call closure_by_move_body_def_id on FnOnce async closures in MIR validation

Refactors the check in rust-lang#129847 to not unncessarily call the `closure_by_move_body_def_id` query for async closures that don't *need* a by-move body.

Fixes rust-lang#130167
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

Cycle detected when optimizing MIR on nightly
5 participants