about summary refs log tree commit diff
path: root/tests/ui/async-await/async-closures/once.rs
blob: a1c56c5de6afd2756edfc3286c70c555a12a5023 (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
// build-pass

#![feature(async_closure)]

use std::future::Future;

extern crate block_on;

struct NoCopy;

fn main() {
    block_on::block_on(async {
        async fn call_once<F: Future>(x: impl Fn(&'static str) -> F) -> F::Output {
            x("hello, world").await
        }
        call_once(async |x: &'static str| {
            println!("hello, {x}");
        }).await
    });
}