Skip to content

Fix FutureDropPoll shim for by-move async closures - #158904

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
KR-bluejay:issue-142559-fix
Aug 8, 2026
Merged

Fix FutureDropPoll shim for by-move async closures#158904
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
KR-bluejay:issue-142559-fix

Conversation

@KR-bluejay

@KR-bluejay KR-bluejay commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Related #142559

When the coroutine is coroutine-closures, build_adrop_for_coroutine_shim used the the ref of the coroutine body.

This PR uses coroutine_by_move_body_def_id to fetch the by-move body.
(matching the existing DropGlue behavior in shim.rs)

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 7, 2026
@rust-log-analyzer

This comment has been minimized.

@KR-bluejay
KR-bluejay marked this pull request as ready for review July 7, 2026 13:14
@rustbot

rustbot commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 7, 2026
@rustbot

rustbot commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the pull request, and welcome! The Rust Project is excited to review your changes, and you should hear from @nnethercote (or someone else) some time within the next two weeks.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue
Why was this reviewer chosen?

The reviewer was selected based on:

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

@nnethercote

Copy link
Copy Markdown
Contributor

I don't know this code at all. Git blame suggests...

r? @cjgillot

@rustbot rustbot assigned cjgillot and unassigned nnethercote Jul 8, 2026
@@ -0,0 +1,19 @@
// Regression test for #142559
//@ run-pass
//@ compile-flags: -Clink-dead-code=true

@oli-obk oli-obk Aug 6, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't use link-dead-code everywhere, it's rather buggy.

Suggested change
//@ compile-flags: -Clink-dead-code=true
//@ compile-flags: --crate-type=lib

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This suggestion would break the test build.

error: 1 errors occurred comparing output.
status: exit status: 0
stdout: none
--- stderr -------------------------------
warning: function `main` is never used
  -->  ~/rust/tests/ui/async-await/async-drop/async-drop-future-drop-poll.rs:19:4
   |
LL | fn main() {}
   |    ^^^^
   |
   = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default

warning: 1 warning emitted
------------------------------------------

---- [ui] tests/ui/async-await/async-drop/async-drop-future-drop-poll.rs stdout end ----

failures:
    [ui] tests/ui/async-await/async-drop/async-drop-future-drop-poll.rs

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To pass the test,

  1. Remove main function
  2. Change -Clink-dead-code=true to --crate-type=lib
  3. Change @ run-pass to @ build-pass

I’ll make another commit for the change

@oli-obk oli-obk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

except for the test nit, the change lgtm

View changes since this review

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 6, 2026
@rustbot

rustbot commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@rustbot

rustbot commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

⚠️ Warning ⚠️

@KR-bluejay

Copy link
Copy Markdown
Contributor Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 6, 2026
@oli-obk

oli-obk commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

@bors squash msg="Fix FutureDropPoll shim for by-move async closures"

@rust-bors

This comment has been minimized.

@rust-bors

rust-bors Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

🔨 2 commits were squashed into b9ad974.

@rust-bors
rust-bors Bot force-pushed the issue-142559-fix branch from f304aae to b9ad974 Compare August 6, 2026 15:21
@oli-obk

oli-obk commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Thanks!

@bors r+ rollup

@rust-bors

rust-bors Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

📌 Commit b9ad974 has been approved by oli-obk

It is now in the queue for this repository.

@rust-bors rust-bors Bot 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 Aug 6, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 6, 2026
…-obk

Fix FutureDropPoll shim for by-move async closures

Related rust-lang#142559

When the coroutine is coroutine-closures, `build_adrop_for_coroutine_shim` used the the ref of the coroutine body.

This PR uses `coroutine_by_move_body_def_id` to fetch the by-move body.
(matching the existing `DropGlue` behavior in `shim.rs`)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 6, 2026
…-obk

Fix FutureDropPoll shim for by-move async closures

Related rust-lang#142559

When the coroutine is coroutine-closures, `build_adrop_for_coroutine_shim` used the the ref of the coroutine body.

This PR uses `coroutine_by_move_body_def_id` to fetch the by-move body.
(matching the existing `DropGlue` behavior in `shim.rs`)
jhpratt added a commit to jhpratt/rust that referenced this pull request Aug 7, 2026
…-obk

Fix FutureDropPoll shim for by-move async closures

Related rust-lang#142559

When the coroutine is coroutine-closures, `build_adrop_for_coroutine_shim` used the the ref of the coroutine body.

This PR uses `coroutine_by_move_body_def_id` to fetch the by-move body.
(matching the existing `DropGlue` behavior in `shim.rs`)
jhpratt added a commit to jhpratt/rust that referenced this pull request Aug 7, 2026
…-obk

Fix FutureDropPoll shim for by-move async closures

Related rust-lang#142559

When the coroutine is coroutine-closures, `build_adrop_for_coroutine_shim` used the the ref of the coroutine body.

This PR uses `coroutine_by_move_body_def_id` to fetch the by-move body.
(matching the existing `DropGlue` behavior in `shim.rs`)
rust-bors Bot pushed a commit that referenced this pull request Aug 7, 2026
Rollup of 14 pull requests

Successful merges:

 - #150885 (Revive L4Re target)
 - #159643 (Add support for splatted function pointers)
 - #160433 (delegation: add support for wrapping of the return value with `From::from`)
 - #160530 (refactor handling of target features in Session)
 - #160606 (bootstrap: Store and use an explicit CheckKind in `check::Rustc`)
 - #160628 (fix ICE in `suggest_add_reference_to_arg` for non-callable items)
 - #160634 (miri subtree update)
 - #158904 (Fix FutureDropPoll shim for by-move async closures)
 - #160335 (dlopen offload)
 - #160445 (codegen: classify localized MSVC linker progress as linker_info)
 - #160504 (cleanup borrowck, improve c-variadic handling)
 - #160587 (Add regression test for associated type outlives bound at call site)
 - #160625 (platform-support/netbsd.md: No longer mention 8.x, due to EoL.)
 - #160636 (derive(Diagnostic): link to proper docs)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 7, 2026
…-obk

Fix FutureDropPoll shim for by-move async closures

Related rust-lang#142559

When the coroutine is coroutine-closures, `build_adrop_for_coroutine_shim` used the the ref of the coroutine body.

This PR uses `coroutine_by_move_body_def_id` to fetch the by-move body.
(matching the existing `DropGlue` behavior in `shim.rs`)
rust-bors Bot pushed a commit that referenced this pull request Aug 7, 2026
…uwer

Rollup of 21 pull requests

Successful merges:

 - #159784 (Hint that memchr returns an in-bounds index)
 - #150885 (Revive L4Re target)
 - #159643 (Add support for splatted function pointers)
 - #160433 (delegation: add support for wrapping of the return value with `From::from`)
 - #160530 (refactor handling of target features in Session)
 - #160606 (bootstrap: Store and use an explicit CheckKind in `check::Rustc`)
 - #160628 (fix ICE in `suggest_add_reference_to_arg` for non-callable items)
 - #160634 (miri subtree update)
 - #157641 (Do not promote extern statics)
 - #158904 (Fix FutureDropPoll shim for by-move async closures)
 - #160103 (Add regression test for GAT bound mismatched type error)
 - #160335 (dlopen offload)
 - #160445 (codegen: classify localized MSVC linker progress as linker_info)
 - #160499 (rustc_resolve: move diagnostic attribute linting to attr parsing)
 - #160504 (cleanup borrowck, improve c-variadic handling)
 - #160577 (expand: Feature gate AST-based attribute macros on expressions and statements)
 - #160587 (Add regression test for associated type outlives bound at call site)
 - #160625 (platform-support/netbsd.md: No longer mention 8.x, due to EoL.)
 - #160636 (derive(Diagnostic): link to proper docs)
 - #160644 (Clean up some manual debug impls)
 - #160649 (move naked function ui tests)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 7, 2026
…-obk

Fix FutureDropPoll shim for by-move async closures

Related rust-lang#142559

When the coroutine is coroutine-closures, `build_adrop_for_coroutine_shim` used the the ref of the coroutine body.

This PR uses `coroutine_by_move_body_def_id` to fetch the by-move body.
(matching the existing `DropGlue` behavior in `shim.rs`)
rust-bors Bot pushed a commit that referenced this pull request Aug 7, 2026
…uwer

Rollup of 20 pull requests

Successful merges:

 - #159784 (Hint that memchr returns an in-bounds index)
 - #150885 (Revive L4Re target)
 - #159643 (Add support for splatted function pointers)
 - #160433 (delegation: add support for wrapping of the return value with `From::from`)
 - #160530 (refactor handling of target features in Session)
 - #160606 (bootstrap: Store and use an explicit CheckKind in `check::Rustc`)
 - #160628 (fix ICE in `suggest_add_reference_to_arg` for non-callable items)
 - #160634 (miri subtree update)
 - #157641 (Do not promote extern statics)
 - #158904 (Fix FutureDropPoll shim for by-move async closures)
 - #160103 (Add regression test for GAT bound mismatched type error)
 - #160335 (dlopen offload)
 - #160445 (codegen: classify localized MSVC linker progress as linker_info)
 - #160499 (rustc_resolve: move diagnostic attribute linting to attr parsing)
 - #160504 (cleanup borrowck, improve c-variadic handling)
 - #160577 (expand: Feature gate AST-based attribute macros on expressions and statements)
 - #160587 (Add regression test for associated type outlives bound at call site)
 - #160625 (platform-support/netbsd.md: No longer mention 8.x, due to EoL.)
 - #160636 (derive(Diagnostic): link to proper docs)
 - #160644 (Clean up some manual debug impls)
jhpratt added a commit to jhpratt/rust that referenced this pull request Aug 7, 2026
…-obk

Fix FutureDropPoll shim for by-move async closures

Related rust-lang#142559

When the coroutine is coroutine-closures, `build_adrop_for_coroutine_shim` used the the ref of the coroutine body.

This PR uses `coroutine_by_move_body_def_id` to fetch the by-move body.
(matching the existing `DropGlue` behavior in `shim.rs`)
rust-bors Bot pushed a commit that referenced this pull request Aug 7, 2026
…uwer

Rollup of 28 pull requests

Successful merges:

 - #159784 (Hint that memchr returns an in-bounds index)
 - #160673 (Improve `canonical_param_env_cache`)
 - #150885 (Revive L4Re target)
 - #159643 (Add support for splatted function pointers)
 - #160433 (delegation: add support for wrapping of the return value with `From::from`)
 - #160530 (refactor handling of target features in Session)
 - #160606 (bootstrap: Store and use an explicit CheckKind in `check::Rustc`)
 - #160628 (fix ICE in `suggest_add_reference_to_arg` for non-callable items)
 - #160683 (Add regression test for unknown feaeture name reported with other errors)
 - #157641 (Do not promote extern statics)
 - #158904 (Fix FutureDropPoll shim for by-move async closures)
 - #159816 (added note/help about iterator invalidation when mutating a collection inside a for loop)
 - #160103 (Add regression test for GAT bound mismatched type error)
 - #160335 (dlopen offload)
 - #160445 (codegen: classify localized MSVC linker progress as linker_info)
 - #160499 (rustc_resolve: move diagnostic attribute linting to attr parsing)
 - #160504 (cleanup borrowck, improve c-variadic handling)
 - #160577 (expand: Feature gate AST-based attribute macros on expressions and statements)
 - #160587 (Add regression test for associated type outlives bound at call site)
 - #160625 (platform-support/netbsd.md: No longer mention 8.x, due to EoL.)
 - #160633 (delegation: fix determining wrong `FnKind` when delegation is inside const arg)
 - #160636 (derive(Diagnostic): link to proper docs)
 - #160644 (Clean up some manual debug impls)
 - #160649 (move naked function ui tests)
 - #160672 (Improve `MaybeLiveLocals`)
 - #160693 (Add branch config for perf. unrolling in bors)
 - #160696 (rustc_codegen_llvm: handle sm_101* features being an alias)
 - #160706 (renovate: clarify that vulnerability PRs are opened automatically)
@rust-bors
rust-bors Bot merged commit a87e770 into rust-lang:main Aug 8, 2026
11 of 13 checks passed
@rustbot rustbot added this to the 1.99.0 milestone Aug 8, 2026
rust-timer added a commit that referenced this pull request Aug 8, 2026
Rollup merge of #158904 - KR-bluejay:issue-142559-fix, r=oli-obk

Fix FutureDropPoll shim for by-move async closures

Related #142559

When the coroutine is coroutine-closures, `build_adrop_for_coroutine_shim` used the the ref of the coroutine body.

This PR uses `coroutine_by_move_body_def_id` to fetch the by-move body.
(matching the existing `DropGlue` behavior in `shim.rs`)
pull Bot pushed a commit to LeeeeeeM/miri that referenced this pull request Aug 8, 2026
…uwer

Rollup of 28 pull requests

Successful merges:

 - rust-lang/rust#159784 (Hint that memchr returns an in-bounds index)
 - rust-lang/rust#160673 (Improve `canonical_param_env_cache`)
 - rust-lang/rust#150885 (Revive L4Re target)
 - rust-lang/rust#159643 (Add support for splatted function pointers)
 - rust-lang/rust#160433 (delegation: add support for wrapping of the return value with `From::from`)
 - rust-lang/rust#160530 (refactor handling of target features in Session)
 - rust-lang/rust#160606 (bootstrap: Store and use an explicit CheckKind in `check::Rustc`)
 - rust-lang/rust#160628 (fix ICE in `suggest_add_reference_to_arg` for non-callable items)
 - rust-lang/rust#160683 (Add regression test for unknown feaeture name reported with other errors)
 - rust-lang/rust#157641 (Do not promote extern statics)
 - rust-lang/rust#158904 (Fix FutureDropPoll shim for by-move async closures)
 - rust-lang/rust#159816 (added note/help about iterator invalidation when mutating a collection inside a for loop)
 - rust-lang/rust#160103 (Add regression test for GAT bound mismatched type error)
 - rust-lang/rust#160335 (dlopen offload)
 - rust-lang/rust#160445 (codegen: classify localized MSVC linker progress as linker_info)
 - rust-lang/rust#160499 (rustc_resolve: move diagnostic attribute linting to attr parsing)
 - rust-lang/rust#160504 (cleanup borrowck, improve c-variadic handling)
 - rust-lang/rust#160577 (expand: Feature gate AST-based attribute macros on expressions and statements)
 - rust-lang/rust#160587 (Add regression test for associated type outlives bound at call site)
 - rust-lang/rust#160625 (platform-support/netbsd.md: No longer mention 8.x, due to EoL.)
 - rust-lang/rust#160633 (delegation: fix determining wrong `FnKind` when delegation is inside const arg)
 - rust-lang/rust#160636 (derive(Diagnostic): link to proper docs)
 - rust-lang/rust#160644 (Clean up some manual debug impls)
 - rust-lang/rust#160649 (move naked function ui tests)
 - rust-lang/rust#160672 (Improve `MaybeLiveLocals`)
 - rust-lang/rust#160693 (Add branch config for perf. unrolling in bors)
 - rust-lang/rust#160696 (rustc_codegen_llvm: handle sm_101* features being an alias)
 - rust-lang/rust#160706 (renovate: clarify that vulnerability PRs are opened automatically)
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.

6 participants