about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2020-01-30 01:46:46 +0100
committerGitHub <noreply@github.com>2020-01-30 01:46:46 +0100
commit1780f2f12f6fa454ea272211ce44d57756abc98f (patch)
tree63d57b66758683620e9c4768b27241d0be8eccc2
parent3df1ff2608eac304b74af024584bd35cff0285cf (diff)
parent684bd50148ea1e240ebfdce2365af7422f46ec53 (diff)
downloadrust-1780f2f12f6fa454ea272211ce44d57756abc98f.tar.gz
rust-1780f2f12f6fa454ea272211ce44d57756abc98f.zip
Rollup merge of #68651 - LeSeulArtichaut:doc-from-nonzero, r=steveklabnik
Document `From` implementation for NonZero nums

This is more of a nitpick than a real change in documentation. I did this for consistency with other documentation (namely Atomic integers).

Related to #51430

r? @steveklabnik

PS: I actually tested the code this time. My CPU died in the process, but I get to open a (hopefully 🤞) working PR
-rw-r--r--src/libcore/num/mod.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs
index 91848abd68d..5d2c1d0de2c 100644
--- a/src/libcore/num/mod.rs
+++ b/src/libcore/num/mod.rs
@@ -91,8 +91,12 @@ assert_eq!(size_of::<Option<core::num::", stringify!($Ty), ">>(), size_of::<", s
 
             #[stable(feature = "from_nonzero", since = "1.31.0")]
             impl From<$Ty> for $Int {
-                fn from(nonzero: $Ty) -> Self {
-                    nonzero.0
+                doc_comment! {
+                    concat!(
+"Converts a `", stringify!($Ty), "` into an `", stringify!($Int), "`"),
+                    fn from(nonzero: $Ty) -> Self {
+                        nonzero.0
+                    }
                 }
             }