From 95ada817be4ed90fe7e2218bf964a3733dd5de85 Mon Sep 17 00:00:00 2001 From: Sergio Benitez Date: Sun, 30 May 2021 06:33:46 -0700 Subject: [PATCH] Test ability to infer any type on empty streams --- async-stream/tests/stream.rs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/async-stream/tests/stream.rs b/async-stream/tests/stream.rs index 32af96c..2354692 100644 --- a/async-stream/tests/stream.rs +++ b/async-stream/tests/stream.rs @@ -8,11 +8,25 @@ use tokio_test::assert_ok; #[tokio::test] async fn noop_stream() { - fn unit() -> impl Stream { + fn any() -> impl Stream { stream! {} } - let s = unit(); + let s = any::<()>(); + pin_mut!(s); + + while let Some(_) = s.next().await { + unreachable!(); + } + + let s = any::(); + pin_mut!(s); + + while let Some(_) = s.next().await { + unreachable!(); + } + + let s = any::(); pin_mut!(s); while let Some(_) = s.next().await {