Feature-gated implementation of rand_core::RngCore for quickcheck::Gen#271
Feature-gated implementation of rand_core::RngCore for quickcheck::Gen#271LukeMathWalker wants to merge 2 commits into
rand_core::RngCore for quickcheck::Gen#271Conversation
…ional (disabled by default) feature flag - `rand_core_0_6`. Structure the features flags to allow backwards-compatible additions of new `RngCore` implementations if `rand_core` were to cut a new release with breaking changes (either 0.7 or 1.x).
|
I'm never making Making it opt-in is arguably even more maintenance work, and does nothing to help with semver. If One thing I would be open to doing is exposing the methods required to implement |
|
Note that I would be open to making rand_core a public dependency if and when it reaches 1.0. |
|
Understood 👌🏼 |
|
So the possible workarounds as of now is to pin quickcheck to 0.9 I believe as in LukeMathWalker/zero-to-production#34 (comment). |
Rationale
The latest version of
quickcheck,1.x.x, has transformedGeninto a struct which does not implement therand_core::RngCoretrait.Reading through #241 it seems the main motivation is API stability:
rand_corehas been publishing minor releases at a much faster pace thanquickcheckand the API does not yet seem stable enough to allowquickcheckto cut a1.0release without having to plan for a2.0shortly afterwards.The other motivation mentioned in the RFC, dependency bloat, seems to have been archived due to a restructuring in
rand's feature flagging system -randis in fact a dependency ofquickcheckin1.0.While I appreciate the driver behind the decision the outcome seems to damage interoperability across the ecosystem - with all its issues,
rand_core::RngCoreis still the reference trait for crates that want to allow a pluggable source of randomness (e.g.fake).I believe there is path forward that allows
quickcheckto avoid unnecessary breaking changes while enabling users that rely onrand_corefor interoperability to get aGenstruct that implementsRngCore- the present PR.There is no denying that somebody has to pay the bill for
rand_core's frequent breaking changes: this PR adds complexity thatquickcheck's maintainers will have to look after going forward, therefore I understand if you don't want to merge it @BurntSushi. But I thought it was worth a shot to flesh it out as a PoC for your evaluation 😁Changes
Add an implementation of
rand_core::RngCoreforGenbehind an optional (disabled by default) feature flag -rand_core_0_6.The features flags are structured to allow backwards-compatible additions of new
RngCoreimplementations ifrand_corewere to cut a new release with breaking changes (either 0.7 or 1.x).