From 060cfbead78ff65f50a7d5e6f52e8bb181b79d29 Mon Sep 17 00:00:00 2001 From: Matthew Russo Date: Fri, 14 Jun 2024 20:04:23 -0700 Subject: [PATCH] [Doc] Arbitrary : add a note about the derive macro in Arbitrary's documentation --- proptest/CHANGELOG.md | 3 +++ proptest/src/arbitrary/traits.rs | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/proptest/CHANGELOG.md b/proptest/CHANGELOG.md index caa7b811..ed627b9d 100644 --- a/proptest/CHANGELOG.md +++ b/proptest/CHANGELOG.md @@ -5,6 +5,9 @@ - Setting `PROPTEST_MAX_DEFAULT_SIZE_RANGE` now customizes the default `SizeRange` used by the default strategies for collections (like `Vec`). The default remains 100. +### Documentation +- Reference the derive macro in Arbitrary's documentation + ### Bug Fixes - Fixed issue where config contextualization would clobber existing failure persistence config diff --git a/proptest/src/arbitrary/traits.rs b/proptest/src/arbitrary/traits.rs index 83f02142..5c42b060 100644 --- a/proptest/src/arbitrary/traits.rs +++ b/proptest/src/arbitrary/traits.rs @@ -36,10 +36,15 @@ use crate::strategy::Strategy; /// which may be lifted in the future as the [generic associated types (GAT)] /// feature of Rust is implemented and stabilized. /// +/// If you do not have unique constraints on how to generate the data for your +/// custom types, consider using [the derive macro] to implement Arbitrary +/// /// [generic associated types (GAT)]: https://github.com/rust-lang/rust/issues/44265 /// /// [`Strategy`]: ../strategy/trait.Strategy.html /// +/// [the derive macro]: https://docs.rs/proptest-derive/latest/proptest_derive/ +/// /// [HaskellQC]: /// https://hackage.haskell.org/package/QuickCheck/docs/Test-QuickCheck-Arbitrary.html pub trait Arbitrary: Sized + fmt::Debug {