Skip to content

StreamExt::buffered and StreamExt::buffer_unordered hangs for n = 0 #2348

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

Closed
EFanZh opened this issue Feb 20, 2021 · 1 comment · Fixed by #2364
Closed

StreamExt::buffered and StreamExt::buffer_unordered hangs for n = 0 #2348

EFanZh opened this issue Feb 20, 2021 · 1 comment · Fixed by #2364
Labels
A-stream Area: futures::stream bug

Comments

@EFanZh
Copy link
Contributor

EFanZh commented Feb 20, 2021

Try the following code:

use futures::executor;
use futures::stream::{self, StreamExt};
use std::future;

fn main() {
    executor::block_on(async {
        let mut s = stream::iter(0..10).map(future::ready).buffered(0);

        while let Some(value) = s.next().await {
            println!("{}", value);
        }
    });
}

Is this the expected behavior?

@taiki-e taiki-e added A-stream Area: futures::stream bug labels Feb 20, 2021
@taiki-e
Copy link
Member

taiki-e commented Feb 20, 2021

I feel this is a bug. I think it's preferable to panic if capacity is 0, like chunks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-stream Area: futures::stream bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants