about summary refs log tree commit diff
path: root/library/core/src/array
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-10-25 18:02:23 +0000
committerbors <bors@rust-lang.org>2022-10-25 18:02:23 +0000
commita46ccba167086f0b562eb78403f7446b0fed5f65 (patch)
tree657acfd56be3293586f6d81d3e35ed543137b54c /library/core/src/array
parentcfd99a2bbe83ae35ad0eb9d963ca97cf6c34471a (diff)
parent5a5a3e4ef4b4c450991459415c0c7a963ba2d278 (diff)
downloadrust-a46ccba167086f0b562eb78403f7446b0fed5f65.tar.gz
rust-a46ccba167086f0b562eb78403f7446b0fed5f65.zip
Auto merge of #2618 - RalfJung:rustup, r=RalfJung
Rustup
Diffstat (limited to 'library/core/src/array')
-rw-r--r--library/core/src/array/mod.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/library/core/src/array/mod.rs b/library/core/src/array/mod.rs
index 04dd821efde..eae0e1c7618 100644
--- a/library/core/src/array/mod.rs
+++ b/library/core/src/array/mod.rs
@@ -32,6 +32,10 @@ pub use iter::IntoIter;
 /// # Example
 ///
 /// ```rust
+/// // type inference is helping us here, the way `from_fn` knows how many
+/// // elements to produce is the length of array down there: only arrays of
+/// // equal lengths can be compared, so the const generic parameter `N` is
+/// // inferred to be 5, thus creating array of 5 elements.
 /// let array = core::array::from_fn(|i| i);
 /// assert_eq!(array, [0, 1, 2, 3, 4]);
 /// ```