rust/tests/ui/async-await/async-closures/async-fn-once-for-async-fn.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

23 lines
423 B
Rust
Raw Normal View History

2024-01-25 11:43:35 -06:00
//@ aux-build:block-on.rs
//@ edition:2021
//@ run-pass
#![feature(async_closure)]
2024-01-25 11:43:35 -06:00
extern crate block_on;
fn main() {
block_on::block_on(async {
async fn needs_async_fn_once(x: impl async FnOnce()) {
2024-01-25 11:43:35 -06:00
x().await;
}
2024-02-26 17:06:38 -06:00
needs_async_fn_once(async || {}).await;
needs_async_fn_once(|| async {}).await;
async fn foo() {}
needs_async_fn_once(foo).await;
2024-01-25 11:43:35 -06:00
});
}