about summary refs log tree commit diff
path: root/tests/ui/async-await/async-closures/async-fn-once-for-async-fn.rs
blob: e7644e3dfe0231465fe25844fe51a271d8f43d1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//@ aux-build:block-on.rs
//@ edition:2021
//@ run-pass

#![feature(async_closure)]

extern crate block_on;

fn main() {
    block_on::block_on(async {
        async fn needs_async_fn_once(x: impl AsyncFnOnce()) {
            x().await;
        }

        needs_async_fn_once(async || {}).await;

        needs_async_fn_once(|| async {}).await;

        async fn foo() {}
        needs_async_fn_once(foo).await;
    });
}