Open
Description
opened on Jun 14, 2024
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
- Skip trivially destructible fields (optimization) (Implement
- 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)
Implementation history
Metadata
Assignees
Labels
Area: Async & AwaitAsync-await issues that have been triaged during a working group meeting.Category: An issue tracking the progress of sth. like the implementation of an RFCAsync dropRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the language team, which will review and decide on the PR/issue.Working group: Async & await
Activity