2024-02-16 14:02:50 -06:00
|
|
|
//@ aux-build:block-on.rs
|
|
|
|
//@ edition:2021
|
|
|
|
//@ build-pass
|
2024-02-06 14:51:56 -06:00
|
|
|
|
|
|
|
#![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
|
|
|
|
});
|
|
|
|
}
|