Skip to content

Async drop source info fix for proxy-drop-coroutine #140630

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

azhogin
Copy link
Contributor

@azhogin azhogin commented May 3, 2025

Fixes crash at debug info generation: #140426 .
Also, the submitted example requires sync Drop implementation too.
Because sync version is required for unwind and when drop is performed in sync context (sync function).

Probably, it is also needed to add such a lint/error about missed impl Drop, when there is impl AsyncDrop.

Fix description: even minimal, empty coroutine (for proxy-coroutine) has 3 states and the source info array should have 3 elements too.

#![feature(async_drop)]

use std::future::AsyncDrop;
use std::pin::Pin;

#[tokio::main(flavor = "current_thread")]
async fn main() {
    let _st = St;
}

struct St;

impl AsyncDrop for St {
    async fn drop(self: Pin<&mut Self>) {
        println!("123");
    }
}

@rustbot
Copy link
Collaborator

rustbot commented May 3, 2025

r? @nnethercote

rustbot has assigned @nnethercote.
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 May 3, 2025
@azhogin
Copy link
Contributor Author

azhogin commented May 3, 2025

r? oli-obk

@rustbot rustbot assigned oli-obk and unassigned nnethercote May 3, 2025
@jieyouxu jieyouxu added the F-async_drop `#![feature(async_drop)]` label May 3, 2025
@azhogin azhogin force-pushed the azhogin/async-drop-proxy-source-info-fix branch from 7eadc69 to a82b7a6 Compare May 3, 2025 20:11
@oli-obk
Copy link
Contributor

oli-obk commented May 4, 2025

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented May 4, 2025

📌 Commit a82b7a6 has been approved by oli-obk

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 May 4, 2025
Zalathar added a commit to Zalathar/rust that referenced this pull request May 4, 2025
…ource-info-fix, r=oli-obk

Async drop source info fix for proxy-drop-coroutine

Fixes crash at debug info generation: rust-lang#140426 .
Also, the submitted example requires sync Drop implementation too.
Because sync version is required for unwind and when drop is performed in sync context (sync function).

Probably, it is also needed to add such a lint/error about missed `impl Drop`, when there is `impl AsyncDrop`.

Fix description: even minimal, empty coroutine (for proxy-coroutine) has 3 states and the source info array should have 3 elements too.

```
#![feature(async_drop)]

use std::future::AsyncDrop;
use std::pin::Pin;

#[tokio::main(flavor = "current_thread")]
async fn main() {
    let _st = St;
}

struct St;

impl AsyncDrop for St {
    async fn drop(self: Pin<&mut Self>) {
        println!("123");
    }
}
```
bors added a commit to rust-lang-ci/rust that referenced this pull request May 4, 2025
Rollup of 3 pull requests

Successful merges:

 - rust-lang#140357 (bypass linker configuration and cross target check on `x check`)
 - rust-lang#140580 (Don't name variables from external macros in borrow errors.)
 - rust-lang#140630 (Async drop source info fix for proxy-drop-coroutine)

r? `@ghost`
`@rustbot` modify labels: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-async_drop `#![feature(async_drop)]` 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