Add simple async drop glue generation#121801
Merged
bors merged 6 commits intorust-lang:masterfrom Apr 23, 2024
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a prototype of the async drop glue generation for some simple types. Async drop glue is intended to behave very similar to the regular drop glue except for being asynchronous. Currently it does not execute synchronous drops but only calls user implementations of
AsyncDrop::async_dropassociative function and awaits the returned future. It is not complete as it only recurses into arrays, slices, tuples, and structs and does not have same sensible restrictions as the oldDroptrait implementation like having the same bounds as the type definition, while code assumes their existence (requires a future work).This current design uses a workaround as it does not create any custom async destructor state machine types for ADTs, but instead uses types defined in the std library called future combinators (deferred_async_drop, chain, ready_unit).
Also I recommend reading my explainer.
This is a part of the MCP: Low level components for async drop work.
Feature completeness:
AsyncDroptraitasync_drop_in_place_raw/async drop glue generation support fordyn Trait, see explainer's proposed design)async_drop_in_place_rawAsyncDropimplementation requires same bounds as type definitionTyKind::AdtAsyncDestructorand get rid of combinators