2024-02-26 22:53:45 +00:00
|
|
|
//@ aux-build:block-on.rs
|
|
|
|
//@ edition:2018
|
|
|
|
//@ revisions: current next
|
2024-03-11 01:18:41 +00:00
|
|
|
//@ ignore-compare-mode-next-solver (explicit revisions)
|
2024-02-26 22:53:45 +00:00
|
|
|
//@[next] compile-flags: -Znext-solver
|
|
|
|
//@ build-pass (since it ICEs during mono)
|
|
|
|
|
|
|
|
extern crate block_on;
|
|
|
|
|
|
|
|
use std::future::Future;
|
|
|
|
|
|
|
|
async fn f(arg: &i32) {}
|
|
|
|
|
|
|
|
async fn func<F>(f: F)
|
|
|
|
where
|
2024-11-04 18:59:57 +00:00
|
|
|
F: for<'a> AsyncFn(&'a i32),
|
2024-02-26 22:53:45 +00: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 {});
|
|
|
|
});
|
|
|
|
}
|