2
0
Fork 1
mirror of https://github.com/async-rs/async-std.git synced 2025-01-16 10:49:55 +00:00
async-std/tests/collect.rs
Yoshua Wuyts c82b1efb69
fix(stream): add send guards on collect
Closes #639 

Co-authored-by: dignifiedquire <me@dignifiedquire.com>
2020-06-27 16:46:14 +02:00

20 lines
463 B
Rust

#[cfg(feature = "unstable")]
#[test]
fn test_send() -> async_std::io::Result<()> {
use async_std::prelude::*;
use async_std::{stream, task};
task::block_on(async {
fn test_send_trait<T: Send>(_: &T) {}
let stream = stream::repeat(1u8).take(10);
test_send_trait(&stream);
let fut = stream.collect::<Vec<_>>();
// This line triggers a compilation error
test_send_trait(&fut);
Ok(())
})
}