rust/tests/ui/async-await/async-closures/brand.rs

26 lines
435 B
Rust
Raw Normal View History

//@ aux-build:block-on.rs
//@ edition:2021
//@ build-pass
2024-01-25 11:43:35 -06:00
#![feature(async_closure)]
2024-01-25 11:43:35 -06:00
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) {
2024-01-25 11:43:35 -06:00
f(B(PhantomData)).await;
}
}
fn main() {
block_on::block_on(async {
S.q(async |b: B<'_>| { println!("...") }).await;
});
}