about summary refs log tree commit diff
path: root/library/core/src/array
diff options
context:
space:
mode:
authorMarkus Reiter <me@reitermark.us>2024-02-18 21:29:24 +0100
committerMarkus Reiter <me@reitermark.us>2024-02-22 15:17:33 +0100
commit14ed426eec6939737ea320e50bb28d239c7aee93 (patch)
tree8a5ec0d0fb9fcb6b540d4a6ce54289f84850d7f9 /library/core/src/array
parent52dba5ffe73c25951fd6ae38bf20513002dd7874 (diff)
downloadrust-14ed426eec6939737ea320e50bb28d239c7aee93.tar.gz
rust-14ed426eec6939737ea320e50bb28d239c7aee93.zip
Use generic `NonZero` everywhere in `core`.
Diffstat (limited to 'library/core/src/array')
-rw-r--r--library/core/src/array/mod.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/library/core/src/array/mod.rs b/library/core/src/array/mod.rs
index 743f07644e3..42663ff2b53 100644
--- a/library/core/src/array/mod.rs
+++ b/library/core/src/array/mod.rs
@@ -511,7 +511,7 @@ impl<T, const N: usize> [T; N] {
     /// # Examples
     ///
     /// ```
-    /// #![feature(array_try_map)]
+    /// #![feature(array_try_map, generic_nonzero)]
     /// let a = ["1", "2", "3"];
     /// let b = a.try_map(|v| v.parse::<u32>()).unwrap().map(|v| v + 1);
     /// assert_eq!(b, [2, 3, 4]);
@@ -520,12 +520,12 @@ impl<T, const N: usize> [T; N] {
     /// let b = a.try_map(|v| v.parse::<u32>());
     /// assert!(b.is_err());
     ///
-    /// use std::num::NonZeroU32;
+    /// use std::num::NonZero;
     /// let z = [1, 2, 0, 3, 4];
-    /// assert_eq!(z.try_map(NonZeroU32::new), None);
+    /// assert_eq!(z.try_map(NonZero::new), None);
     /// let a = [1, 2, 3];
-    /// let b = a.try_map(NonZeroU32::new);
-    /// let c = b.map(|x| x.map(NonZeroU32::get));
+    /// let b = a.try_map(NonZero::new);
+    /// let c = b.map(|x| x.map(NonZero::get));
     /// assert_eq!(c, Some(a));
     /// ```
     #[unstable(feature = "array_try_map", issue = "79711")]