about summary refs log tree commit diff
path: root/tests/ui/typeck/issue-116864.rs
blob: 6cbe56b2f926a3b2ecd4192c784e8e4473e84525 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//@ compile-flags: -Znext-solver
//@ check-pass
//@ edition: 2021

use std::future::Future;

trait Baz {
    type Param;
}

trait FnMutFut<P, R>: FnMut(P) -> Self::Future {
    type Future: Future<Output = R>;
}

impl<P, F, FUT, R> FnMutFut<P, R> for F
where
    F: FnMut(P) -> FUT,
    FUT: Future<Output = R>,
{
    type Future = FUT;
}

async fn foo<BAZ>(_: BAZ, mut cb: impl for<'any> FnMutFut<&'any BAZ::Param, ()>)
where
    BAZ: Baz<Param = i32>,
{
    cb(&1i32).await;
}

fn main() {
}