Prevent waitable-set.{wait,poll} from being used at the same time as sync built-ins#647
Open
lukewagner wants to merge 1 commit intomainfrom
Open
Prevent waitable-set.{wait,poll} from being used at the same time as sync built-ins#647lukewagner wants to merge 1 commit intomainfrom
lukewagner wants to merge 1 commit intomainfrom
Conversation
alexcrichton
approved these changes
May 5, 2026
Collaborator
alexcrichton
left a comment
There was a problem hiding this comment.
To me this seems reasonable yeah in the sense that in higher-level situations when you're performing a future/stream operation you've probably already got ownership of the future/stream so you should be able to have complete control over the state of the stream before/after so having extra requirement shouldn't be too onerous.
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.
This PR is one way to resolve the ambiguity discovered in #642.
One option is to give the sync operations "priority" over the waitable-set, and that's what I started with. But it's a pretty complex behavior to test for and so it seems likely to be a bug in production. It's also not clear if it's actually the desired behavior or whether it might be masking a bug that a trap would've helped catch much earlier.
So instead, this PR just traps, both if attempting to start a sync operation on a waitable that's already in a waitable-set or, conversely, if trying to add a waitable to a waitable-set when there's already a sync operation in progress. This is also a conservative choice, and we could switch to the above later if a compelling reason arose.