Skip to content
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

Fix panics in Merge and Chain size hints #2430

Merged
merged 1 commit into from
Apr 23, 2020
Merged

Conversation

MikailBag
Copy link
Contributor

@MikailBag MikailBag commented Apr 22, 2020

Motivation

Currently, Merge and Chain streams incorrectly handle overflows: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=2f99c2f8f392d0fd068c050da7092cf3

This PR changes both places to use new merge_size_hints function that handles overflow (I believe :) ) properly.

Copy link
Contributor

@kleimkuhler kleimkuhler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good! If you can reword the comment for merge_size_hints this should be good to go. Thanks for adding the tests.

tokio/src/stream/mod.rs Outdated Show resolved Hide resolved
@Darksonn Darksonn added A-tokio Area: The main tokio crate C-bug Category: This is a bug. M-stream Module: tokio/stream S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 23, 2020
Copy link
Contributor

@kleimkuhler kleimkuhler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@Darksonn Darksonn removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 23, 2020
@Darksonn Darksonn merged commit 236629d into tokio-rs:master Apr 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate C-bug Category: This is a bug. M-stream Module: tokio/stream
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants