-
-
Notifications
You must be signed in to change notification settings - Fork 3k
sync: return TryRecvError::Disconnected from Receiver::try_recv after Receiver::close
#7686
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
d375c60
sync: treat try_recv after close as disconnected (#7631)
KR-bluejay 116f66d
Merge branch 'master' into try-recv-close
KR-bluejay 0762d01
Update tokio/src/sync/mpsc/chan.rs
KR-bluejay fa5b8bf
sync: fix try_recv close match arm
KR-bluejay e434742
sync: update list TryPopResult docs for receiver close
KR-bluejay 8212c42
sync: clarify TryPopResult empty doc
KR-bluejay File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Docs updated per discussion at this line. If you prefer different wording, I can adjust anytime. |
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
|
Darksonn marked this conversation as resolved.
|
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you update documentation for
TryPopResult::Emptyintokio/src/sync/mpsc/list.rsto mention that it might be closed.In fact, maybe
Emptyshould be renamed?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or maybe
Closedshould be renamed toClosedBySender?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a docs-only update would be the best approach for now:
TryPopResult::Emptycan be returned afterRx::close()when the queue is empty (even if senders still exist)TryPopResult::Closedspecifically means the send half closed (all senders dropped, no further items will be produced)I'd prefer to defer renaming the variants in this PR. My concern is that if we rename now and discover additional edge cases later, we might need to rename again, which could cause unnecessary churn.
That said, I'm open to including the rename if you feel strongly about it—just wanted to share my reasoning. Would this documentation approach work for you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok