2024-02-26 16:53:45 -06:00
|
|
|
//@ aux-build:block-on.rs
|
|
|
|
//@ edition:2018
|
|
|
|
//@ revisions: current next
|
2024-03-10 20:18:41 -05:00
|
|
|
//@ ignore-compare-mode-next-solver (explicit revisions)
|
2024-02-26 16:53:45 -06:00
|
|
|
//@[next] compile-flags: -Znext-solver
|
|
|
|
//@ build-pass (since it ICEs during mono)
|
|
|
|
|
|
|
|
#![feature(async_closure)]
|
|
|
|
|
|
|
|
extern crate block_on;
|
|
|
|
|
|
|
|
use std::future::Future;
|
|
|
|
|
|
|
|
async fn f(arg: &i32) {}
|
|
|
|
|
|
|
|
async fn func<F>(f: F)
|
|
|
|
where
|
2024-06-27 11:58:35 -05:00
|
|
|
F: for<'a> async Fn(&'a i32),
|
2024-02-26 16:53:45 -06:00
|
|
|
{
|
|
|
|
let x: i32 = 0;
|
|
|
|
f(&x).await;
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
block_on::block_on(async {
|
|
|
|
// Function
|
|
|
|
func(f).await;
|
|
|
|
|
|
|
|
// Regular closure (doesn't capture)
|
|
|
|
func(|x: &i32| async {});
|
|
|
|
});
|
|
|
|
}
|