rust/tests/ui/async-await/async-closures/kind-due-to-arg-with-box-wrap.rs

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

23 lines
500 B
Rust
Raw Permalink Normal View History

//@ edition: 2024
// Regression test for <https://github.com/rust-lang/rust/issues/140292>.
struct Test;
impl Test {
async fn an_async_fn(&mut self) {
todo!()
}
pub async fn uses_takes_asyncfn(&mut self) {
takes_asyncfn(Box::new(async || self.an_async_fn().await));
//~^ ERROR expected a closure that implements the `AsyncFn` trait, but this closure only implements `AsyncFnMut`
}
}
async fn takes_asyncfn(_: impl AsyncFn()) {
todo!()
}
fn main() {}