diff options
| -rw-r--r-- | tests/ui/typeck/issue-116864.rs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/ui/typeck/issue-116864.rs b/tests/ui/typeck/issue-116864.rs new file mode 100644 index 00000000000..88c3f786608 --- /dev/null +++ b/tests/ui/typeck/issue-116864.rs @@ -0,0 +1,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() { +} |
