Skip to content

Commit b093e0c

Browse files
Add a couple more tests
1 parent 2fa6144 commit b093e0c

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// aux-build:block-on.rs
2+
// edition:2021
3+
// build-pass
4+
5+
#![feature(async_closure)]
6+
7+
use std::future::Future;
8+
9+
extern crate block_on;
10+
11+
struct NoCopy;
12+
13+
fn main() {
14+
block_on::block_on(async {
15+
async fn call_once<F: Future>(x: impl Fn(&'static str) -> F) -> F::Output {
16+
x("hello, world").await
17+
}
18+
call_once(async |x: &'static str| {
19+
println!("hello, {x}");
20+
}).await
21+
});
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// aux-build:block-on.rs
2+
// edition:2021
3+
// build-pass
4+
5+
// check that `&{async-closure}` implements `AsyncFn`.
6+
7+
#![feature(async_closure)]
8+
9+
extern crate block_on;
10+
11+
struct NoCopy;
12+
13+
fn main() {
14+
block_on::block_on(async {
15+
async fn call_once(x: impl async Fn()) { x().await }
16+
call_once(&async || {}).await
17+
});
18+
}

0 commit comments

Comments
 (0)