Skip to content

Async drop fix for dropee from another crate (#140858) #141031

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 15, 2025

Fixes #140858.

For AsyncDestructor impl def id was wrongly kept as a LocalDefId, which causes crash when dropee is declared in another crate.

Also, potential problem found:
when user crate drops type with async drop in dependency crate, and user crate doesn't enable feature(async_drop), then sync drop version will be used.

Is it a problem? Do we need some notification about such situations?

@rustbot
Copy link
Collaborator

rustbot commented May 15, 2025

r? @wesleywiser

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

azhogin commented May 15, 2025

r? oli-obk

@rust-log-analyzer

This comment has been minimized.

@oli-obk
Copy link
Contributor

oli-obk commented May 15, 2025

when user crate drops type with async drop in dependency crate, and user crate doesn't enable feature(async_drop), then sync drop version will be used.

Is it a problem? Do we need some notification about such situations?

I don't think it's a problem. I don't see a way around this except making crates that have async drop enabled infecting all crates that depend on it to also have it enabled. If there's an easy way to warn/error about it that you can see and that you think would be good, we can add it, but otherwise please just add a test explaining it.

@azhogin azhogin force-pushed the azhogin/async-drop-dependency-fix branch from 688a1e9 to 7b2dcf2 Compare May 15, 2025 13:05
@oli-obk
Copy link
Contributor

oli-obk commented May 15, 2025

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented May 15, 2025

📌 Commit 7b2dcf2 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 15, 2025
hkBst added a commit to hkBst/rust that referenced this pull request May 16, 2025
…ncy-fix, r=oli-obk

Async drop fix for dropee from another crate (rust-lang#140858)

Fixes rust-lang#140858.

For `AsyncDestructor` impl def id was wrongly kept as a LocalDefId, which causes crash when dropee is declared in another crate.

Also, potential problem found:
when user crate drops type with async drop in dependency crate, and user crate doesn't enable `feature(async_drop)`, then sync drop version will be used.

Is it a problem? Do we need some notification about such situations?
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request May 17, 2025
…ncy-fix, r=oli-obk

Async drop fix for dropee from another crate (rust-lang#140858)

Fixes rust-lang#140858.

For `AsyncDestructor` impl def id was wrongly kept as a LocalDefId, which causes crash when dropee is declared in another crate.

Also, potential problem found:
when user crate drops type with async drop in dependency crate, and user crate doesn't enable `feature(async_drop)`, then sync drop version will be used.

Is it a problem? Do we need some notification about such situations?
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.

when dependency enable async_drop feature, it cause ICE
6 participants