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.

26 lines
435 B
Rust
Raw Normal View History

2024-01-25 11:43:35 -06:00
//@ aux-build:block-on.rs
//@ edition:2021
//@ build-pass
#![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;
});
}