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

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

24 lines
406 B
Rust
Raw Permalink Normal View History

2024-01-25 17:43:35 +00:00
//@ aux-build:block-on.rs
//@ edition:2021
//@ build-pass
extern crate block_on;
use std::future::Future;
use std::marker::PhantomData;
struct S;
struct B<'b>(PhantomData<&'b mut &'b mut ()>);
impl S {
2024-11-04 18:59:57 +00:00
async fn q<F: AsyncFn(B<'_>)>(self, f: F) {
2024-01-25 17:43:35 +00:00
f(B(PhantomData)).await;
}
}
fn main() {
block_on::block_on(async {
S.q(async |b: B<'_>| { println!("...") }).await;
});
}