diff --git a/src/lib.rs b/src/lib.rs index ffdf462..79f26e8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -39,8 +39,9 @@ pub use derive_arbitrary::*; pub use unstructured::Unstructured; /// Error indicating that the maximum recursion depth has been reached while calculating [`Arbitrary::size_hint`]() -#[derive(Debug, Clone, Copy)] -pub struct MaxRecursionReached; +#[derive(Debug, Clone)] +#[non_exhaustive] +pub struct MaxRecursionReached {} impl core::fmt::Display for MaxRecursionReached { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { diff --git a/src/size_hint.rs b/src/size_hint.rs index 821752e..95707ee 100644 --- a/src/size_hint.rs +++ b/src/size_hint.rs @@ -40,7 +40,7 @@ pub fn try_recursion_guard( f: impl FnOnce(usize) -> Result<(usize, Option), crate::MaxRecursionReached>, ) -> Result<(usize, Option), crate::MaxRecursionReached> { if depth > MAX_DEPTH { - Err(crate::MaxRecursionReached) + Err(crate::MaxRecursionReached {}) } else { f(depth + 1) }