Skip to content

StreamExt::collect does not preserve Send #639

Closed
@rmanoka

Description

@rmanoka

Hi,

The StreamExt::collect in this crate (with unstable feature-flag) converts a Send stream into future that is not Send anymore. On the other hand, futures::StreamExt seems to preserve this auto trait. This is not a mission-critical issue, but thought I'll bring it to your attention anyway.

Test code to reproduce this, that yields a compilation error:

#[async_std::test]
async fn test_send() {
    fn test_send_trait<T: Send>(_: &T) {}

    let stream = futures::stream::pending::<()>();
    test_send_trait(&stream);

    use async_std::prelude::StreamExt;
    let fut = stream.collect::<Vec<_>>();

    // This line triggers a compilation error
    test_send_trait(&fut);
}

Tested on 1.4.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions