Conversation
chavic
force-pushed
the
fix/async-callback-completion
branch
from
September 11, 2026 16:02
41aa8df to
fe9c077
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Following up on #163. If an async Dart callback returns
256for a Rustu8, result conversion throws after the callback has already been marked cancelled. The catch branch then returns without notifying Rust, leaving the caller waiting.This separates completion from cancellation and only marks completion once the result or error is ready to pass back. A failure while lowering the result can therefore complete with an error, and a cancelled callback still stays cancelled.
I've tested this through a real Rust future and directly through the generated callback. The async suite passed all 36 Dart tests, including eight new cases covering invalid results, declared and unexpected errors, cancellation, and cleanup during completion. Restoring the old ordering makes the new invalid-result test time out, so it catches the original bug. Formatting and diff checks passed too.
Callback threading remains in #161; failures while serializing the error itself and ownership rollback inside complex converters remain separate work.
Fixes #163.