From: Ian Jackson Date: Thu, 20 Apr 2023 15:49:16 +0000 (+0100) Subject: Revert "Breaks inference" X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=57dd437ae12e479b451456a168eef4b5f1d6251b;p=rust-experiments.git Revert "Breaks inference" This reverts commit e26de1f788f5e2493ecd6a30c9c6e1ef14084071. --- diff --git a/src/main.rs b/src/main.rs index 802c5d1..3b6259c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,11 +5,11 @@ pub trait Callable: Any { type Output; fn callable_call(self, a: Args) -> Self::Output; } -impl Callable<(A,)> for fn(A) -> O { +impl Callable<(A,)> for F where F: Fn(A) -> O + 'static { type Output = O; fn callable_call(self, (a,): (A,)) -> O { (self)(a) } } -impl Callable<(A,B)> for fn(A,B) -> O { +impl Callable<(A,B)> for F where F: Fn(A,B) -> O + 'static { type Output = O; fn callable_call(self, (a,b): (A,B)) -> O { (self)(a,b) } }