From 76b866c715668e032d2369c3212d1c2bd8a297a0 Mon Sep 17 00:00:00 2001 From: frectonz Date: Sun, 3 Nov 2024 18:19:44 +0300 Subject: [PATCH] Modify `NonZero` documentation to reference the underlying integer type This change updates the documentation for `NonZero` integer types to explicitly reference the underlying integer type each `NonZero` variant wraps, instead of using a general "integer" term. --- core/src/num/nonzero.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/core/src/num/nonzero.rs b/core/src/num/nonzero.rs index e2560f48e5998..c056a1ced3ccf 100644 --- a/core/src/num/nonzero.rs +++ b/core/src/num/nonzero.rs @@ -458,7 +458,15 @@ macro_rules! nonzero_integer { reversed = $reversed:literal, leading_zeros_test = $leading_zeros_test:expr, ) => { - /// An integer that is known not to equal zero. + #[doc = sign_dependent_expr!{ + $signedness ? + if signed { + concat!("An [`", stringify!($Int), "`] that is known not to equal zero.") + } + if unsigned { + concat!("A [`", stringify!($Int), "`] that is known not to equal zero.") + } + }] /// /// This enables some memory layout optimization. #[doc = concat!("For example, `Option<", stringify!($Ty), ">` is the same size as `", stringify!($Int), "`:")]