diff --git a/src/impl_constructors.rs b/src/impl_constructors.rs index a4e236e28..964003dd8 100644 --- a/src/impl_constructors.rs +++ b/src/impl_constructors.rs @@ -533,20 +533,22 @@ where /// an easier way to handle uninit values correctly. /// /// Only *when* the array is completely initialized with valid elements, can it be - /// converted to an array of `A` elements using [`assume_init()`]. + /// converted to an array of `A` elements using [`.assume_init()`]. /// /// **Panics** if the number of elements in `shape` would overflow isize. /// /// ### Safety /// /// The whole of the array must be initialized before it is converted - /// using [`assume_init()`] or otherwise traversed. + /// using [`.assume_init()`] or otherwise traversed. /// /// ### Examples /// /// It is possible to assign individual values through `*elt = MaybeUninit::new(value)` /// and so on. /// + /// [`.assume_init()`]: ArrayBase::assume_init + /// /// ``` /// use ndarray::{s, Array2}; /// use ndarray::Zip; diff --git a/src/impl_special_element_types.rs b/src/impl_special_element_types.rs index 9b86625a1..40cba5822 100644 --- a/src/impl_special_element_types.rs +++ b/src/impl_special_element_types.rs @@ -27,7 +27,15 @@ where /// **Promise** that the array's elements are all fully initialized, and convert /// the array from element type `MaybeUninit` to `A`. /// - /// For owned arrays, the promise must include all of the Array's storage + /// For example, it can convert an `Array, D>` to `Array`. + /// + /// ## Safety + /// + /// Safe to use if all the array's elements have been initialized. + /// + /// Note that for owned and shared ownership arrays, the promise must include all of the + /// array's storage; it is for example possible to slice these in place, but that must + /// only be done after all elements have been initialized. pub unsafe fn assume_init(self) -> ArrayBase<>::Output, D> { // NOTE: Fully initialized includes elements not reachable in current slicing/view.