2024-02-20 15:43:29 +00:00
|
|
|
//@ aux-build:block-on.rs
|
2023-12-20 17:41:51 +00:00
|
|
|
//@ edition: 2021
|
2024-02-05 19:17:18 +00:00
|
|
|
//@ build-pass
|
2023-12-20 17:41:51 +00:00
|
|
|
|
|
|
|
#![feature(async_fn_traits)]
|
|
|
|
|
2024-02-20 15:43:29 +00:00
|
|
|
extern crate block_on;
|
|
|
|
|
2023-12-20 17:41:51 +00:00
|
|
|
use std::ops::AsyncFn;
|
|
|
|
|
|
|
|
async fn foo() {}
|
|
|
|
|
|
|
|
async fn call_asyncly(f: impl AsyncFn(i32) -> i32) -> i32 {
|
2023-12-20 18:03:21 +00:00
|
|
|
f(1).await
|
2023-12-20 17:41:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2024-02-20 15:43:29 +00:00
|
|
|
block_on::block_on(async {
|
|
|
|
call_asyncly(|x| async move { x + 1 }).await;
|
|
|
|
});
|
2023-12-20 17:41:51 +00:00
|
|
|
}
|