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-24 00:29:51 +0000
committerbors <bors@rust-lang.org>2022-10-24 00:29:51 +0000
commit7feb003882ecf7699e6705b537673e20985accff (patch)
tree1b40d50643374db387bde03626fabbc1845439db /library/core/src/array
parent7aa361390867181d225a7775340f50e8162e16a2 (diff)
parentae2b1f096f888b4a248665184cb11fe763012a50 (diff)
downloadrust-7feb003882ecf7699e6705b537673e20985accff.tar.gz
rust-7feb003882ecf7699e6705b537673e20985accff.zip
Auto merge of #103452 - notriddle:rollup-peewevm, r=notriddle
Rollup of 11 pull requests

Successful merges:

 - #100462 (Clarify `array::from_fn` documentation)
 - #101644 (Document surprising and dangerous fs::Permissions behaviour on Unix)
 - #103005 (kmc-solid: Handle errors returned by `SOLID_FS_ReadDir`)
 - #103140 (Add diagnostic for calling a function with the same name with unresolved Macro)
 - #103254 (rustdoc: do not filter out cross-crate `Self: Sized` bounds)
 - #103347 (bootstrap: also create rustc-src component in sysroot)
 - #103402 (Fix wrapped valid-range handling in ty_find_init_error)
 - #103414 (Pretty print lifetimes captured by RPIT)
 - #103424 (rustdoc: remove no-op CSS `.code-header { border-bottom: none }`)
 - #103434 (Use functions for jump-to-def-background rustdoc GUI test)
 - #103447 (`MaybeUninit`: use `assume_init_drop()` in the partially initialized array example)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
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]);
 /// ```