From 9d66cfaa08aaf2615242275a7271cada8344f5cf 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. --- library/core/src/num/nonzero.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/library/core/src/num/nonzero.rs b/library/core/src/num/nonzero.rs index e2560f48e59..c056a1ced3c 100644 --- a/library/core/src/num/nonzero.rs +++ b/library/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), "`:")]