blob: 8c16ecb15313051ed9de9866fac1c9fdf83cabf4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
//@ aux-build:block-on.rs
//@ edition:2021
//@ build-pass
#![feature(async_closure)]
extern crate block_on;
struct NoCopy;
fn main() {
block_on::block_on(async {
async fn call_once(x: impl AsyncFn()) { x().await }
// check that `&{async-closure}` implements `AsyncFn`.
call_once(&async || {}).await;
// check that `&{closure}` implements `AsyncFn`.
call_once(&|| async {}).await;
// check that `&fndef` implements `AsyncFn`.
async fn foo() {}
call_once(&foo).await;
});
}
|