Skip to content

Commit ff477c5

Browse files
committed
Test ability to infer any type on empty streams
1 parent e1181e2 commit ff477c5

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

async-stream/tests/stream.rs

+16-2
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,25 @@ use tokio_test::assert_ok;
88

99
#[tokio::test]
1010
async fn noop_stream() {
11-
fn unit() -> impl Stream<Item = ()> {
11+
fn any<T>() -> impl Stream<Item = T> {
1212
stream! {}
1313
}
1414

15-
let s = unit();
15+
let s = any::<()>();
16+
pin_mut!(s);
17+
18+
while let Some(_) = s.next().await {
19+
unreachable!();
20+
}
21+
22+
let s = any::<usize>();
23+
pin_mut!(s);
24+
25+
while let Some(_) = s.next().await {
26+
unreachable!();
27+
}
28+
29+
let s = any::<String>();
1630
pin_mut!(s);
1731

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

0 commit comments

Comments
 (0)