Skip to content

Commit b6991ce

Browse files
Make MaxRecursionReached error possible to evolve in the future
1 parent e5897a1 commit b6991ce

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ pub use derive_arbitrary::*;
3939
pub use unstructured::Unstructured;
4040

4141
/// Error indicating that the maximum recursion depth has been reached while calculating [`Arbitrary::size_hint`]()
42-
#[derive(Debug, Clone, Copy)]
43-
pub struct MaxRecursionReached;
42+
#[derive(Debug, Clone)]
43+
#[non_exhaustive]
44+
pub struct MaxRecursionReached {}
4445

4546
impl core::fmt::Display for MaxRecursionReached {
4647
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {

src/size_hint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pub fn try_recursion_guard(
4040
f: impl FnOnce(usize) -> Result<(usize, Option<usize>), crate::MaxRecursionReached>,
4141
) -> Result<(usize, Option<usize>), crate::MaxRecursionReached> {
4242
if depth > MAX_DEPTH {
43-
Err(crate::MaxRecursionReached)
43+
Err(crate::MaxRecursionReached {})
4444
} else {
4545
f(depth + 1)
4646
}

0 commit comments

Comments
 (0)