about summary refs log tree commit diff
path: root/tests/ui/async-await/async-closures/kind-due-to-arg-with-box-wrap.rs
blob: 650fb10d94be0365f9c9251501152ffde4acbcca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//@ 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() {}