mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 23:12:02 +00:00
26 lines
435 B
Rust
26 lines
435 B
Rust
//@ aux-build:block-on.rs
|
|
//@ edition:2021
|
|
//@ build-pass
|
|
|
|
#![feature(async_closure)]
|
|
|
|
extern crate block_on;
|
|
|
|
use std::future::Future;
|
|
use std::marker::PhantomData;
|
|
|
|
struct S;
|
|
struct B<'b>(PhantomData<&'b mut &'b mut ()>);
|
|
|
|
impl S {
|
|
async fn q<F: async Fn(B<'_>)>(self, f: F) {
|
|
f(B(PhantomData)).await;
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
block_on::block_on(async {
|
|
S.q(async |b: B<'_>| { println!("...") }).await;
|
|
});
|
|
}
|