Skip to content

Commit

Permalink
Test ability to infer any type on empty streams
Browse files Browse the repository at this point in the history
  • Loading branch information
SergioBenitez committed May 30, 2021
1 parent d0caa18 commit e12dd30
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions async-stream/tests/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,25 @@ use tokio_test::assert_ok;

#[tokio::test]
async fn noop_stream() {
fn unit() -> impl Stream<Item = ()> {
fn any<T>() -> impl Stream<Item = T> {
stream! {}
}

let s = unit();
let s = any::<()>();
pin_mut!(s);

while let Some(_) = s.next().await {
unreachable!();
}

let s = any::<usize>();
pin_mut!(s);

while let Some(_) = s.next().await {
unreachable!();
}

let s = any::<String>();
pin_mut!(s);

while let Some(_) = s.next().await {
Expand Down

0 comments on commit e12dd30

Please sign in to comment.