about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJubilee <workingjubilee@gmail.com>2024-11-03 15:24:59 -0800
committerGitHub <noreply@github.com>2024-11-03 15:24:59 -0800
commit1505997c64c2aa4a3736a4e480ef69dbfaa810da (patch)
tree79a313ed751ebf695d11259b0164a4c1fd2a4d95
parentcf712a248568b10ccd8d78a7642e6c1fb084ae9c (diff)
parent9d66cfaa08aaf2615242275a7271cada8344f5cf (diff)
downloadrust-1505997c64c2aa4a3736a4e480ef69dbfaa810da.tar.gz
rust-1505997c64c2aa4a3736a4e480ef69dbfaa810da.zip
Rollup merge of #132563 - frectonz:master, r=Amanieu
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.

**Before**
![image](https://github.com/user-attachments/assets/b13bda82-007b-459c-8b22-e27d79005271)

**After**
![image](https://github.com/user-attachments/assets/1d7fadc7-dce3-4b84-9b8f-d2bb81c05eb7)
-rw-r--r--library/core/src/num/nonzero.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/library/core/src/num/nonzero.rs b/library/core/src/num/nonzero.rs
index d35d6436f2f..056b4b2d750 100644
--- a/library/core/src/num/nonzero.rs
+++ b/library/core/src/num/nonzero.rs
@@ -472,7 +472,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), "`:")]