You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Curious, why do I need to remind the compiler that my fn (seed : usize, password : String) -> bool { ... } is a fn(usize, String) -> bool with the as token when I pass this function to quickcheck::quickcheck()?
As a workaround, I am declaring my properties as lambdas variables, explicitly typed to their signatures. But I would prefer not to have to do this.
The text was updated successfully, but these errors were encountered:
Nobody would prefer to do this. I think this requirement was introduced here by making each fn item have its own distinct type: rust-lang/rust#19891
There is already an issue tracking this problem for quickcheck, and in particular, we would like to be ablw to use closures for property functions: #56
The quickcheck macro is meant to alleviate this annoyance in some cases.
Hi @BurntSushi -- I'm just a beginner with Rust but I'm struggling to understand what the benefit of that "unique type per fn item" PR was. We can see the downside of it is lots of extra as fn(...) -> ... annotations in heavily functional code, but there must have been some good reason to do it that outweighed the noise?
That PR was from 6 years ago. I don't have any context on it now. FWIW, I've only ever run into this problem with quickcheck specifically. I do not think it is endemic to "heavily functional" code.
Curious, why do I need to remind the compiler that my
fn (seed : usize, password : String) -> bool { ... }
is afn(usize, String) -> bool
with theas
token when I pass this function toquickcheck::quickcheck()
?As a workaround, I am declaring my properties as lambdas variables, explicitly typed to their signatures. But I would prefer not to have to do this.
The text was updated successfully, but these errors were encountered: