Tracking Issue for async drop codegen
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
This is a tracking issue for the async drop codegen from MCP "727" (rust-lang/compiler-team#727).
The feature gate for the issue is #![feature(async_drop))].
About tracking issues
Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
Discussion comments will get marked as off-topic or deleted.
Repeated discussions on the tracking issue may lead to the tracking issue getting locked.
Steps
- Implement the async drop codegen
-
AsyncDroptrait (#121801) -
async_drop_in_place_raw/async drop glue generation support for- Trivially destructible types (integers, bools, floats, string slices, pointers, references, etc.), arrays and slices (array pointer is unsized into slice pointer), ADTs (enums, structs, unions), tuple-like types (tuples, closures) (#121801)
- Dynamic types (
dyn Trait) - Coroutines (#123948)
- Type level support (possibly outside of the scope of this tracking issue)
- Union rejects non-trivially async destructible fields
-
AsyncDropimplementation requires same bounds as type definition - Synchronously undroppable types
- Optimizations
- Skip trivially destructible fields (optimization) (#124662)
- New
TyKind::AdtAsyncDestructorand get rid of combinators (obsoleted by https://github.com/rust-lang/rust/pull/123948)
- Automatic async drop at the end of the scope in async context (#123948)
-
- Adjust documentation (see instructions on rustc-dev-guide)
-
Formatting for new syntax has been added to the Style Guide (nightly-style-procedure) - Stabilization PR (see instructions on rustc-dev-guide)
Unresolved Questions
- Async drop for dynamic types (
dyn Trait)- One proposed design: https://zetanumbers.github.io/book/async-drop-design.html#dyn_trait
- Drop of async destructors
-
AsyncDropandDropshould somehow be combined to not duplicate implementations (possibly outside of the scope of this tracking issue)
Implementation history
- #121801
- #124662
- #123948
- Many fixes after #123948 - https://github.com/rust-lang/rust/issues?q=label%3AF-async_drop%20is%3Apr
- https://github.com/rust-lang/rust/pull/156649
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the async drop codegen tracking checklist and the linked MCP 727 discussion, then review the open dynamic-type, type-level-support, documentation, and stabilization items. The linked issues and pull requests provide the implementation history; completion requires resolving the remaining checklist items and preparing documentation and stabilization work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100