Closed michaelsproul closed 9 years ago
Ah, just found #56.
Yup, this is a duplicate of #56.
Even since the introduction of the Fn
traits, I've tried to modify quickcheck to use them, but I haven't succeeded yet. As my comment in #56 notes, I think I'm currently blocked on this: https://github.com/rust-lang/rust/issues/25041
At the moment when passing a function to
quickcheck
, its type has to specified:However, bare functions can be passed as generic items implementing
Fn
traits without any casting:If we implemented the
Testable
trait forF where F: Fn(A, ...) -> T
instead of the concretefn(A, ...) - T
types, it would be possible to just do:I think this is a usability win, especially with
#[quickcheck]
unusable under 1.0 (people are likely to be writing quickcheck quite a bit).I had a quick go at implementing this, but ran into trouble with the
Fun
trait. I couldn't work out a way to call the function (passed as&self
) in amove
closure passed tosafe
. It may be possible, or else more extensive restructuring may be required.