Tracking Issue for async drop codegen · Issue #126482 · rust-lang/rust (original) (raw)
Navigation Menu
- GitHub Copilot Write better code with AI
- GitHub Models New Manage and compare prompts
- GitHub Advanced Security Find and fix vulnerabilities
- Actions Automate any workflow
- Codespaces Instant dev environments
- Issues Plan and track work
- Code Review Manage code changes
- Discussions Collaborate outside of code
- Code Search Find more, search less
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Appearance settings
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
AsyncDrop
trait (Add simple async drop glue generation #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) (Add simple async drop glue generation #121801)
* Dynamic types (dyn Trait
)
* One proposed design: https://zetanumbers.github.io/book/async-drop-design.html#dyn_trait
* Coroutines (Async drop codegen #123948)- Type level support (possibly outside of the scope of this tracking issue)
* Union rejects non-trivially async destructible fields
*AsyncDrop
implementation requires same bounds as type definition
* Synchronously undroppable types - Optimizations
* Skip trivially destructible fields (optimization) (Implement needs_async_drop in rustc and optimize async drop glue #124662)
* New TyKind::AdtAsyncDestructor and get rid of combinators - Automatic async drop at the end of the scope in async context (Async drop codegen #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
AsyncDrop
andDrop
should somehow be combined to not duplicate implementations (possibly outside of the scope of this tracking issue)