diff --git a/src/impl_constructors.rs b/src/impl_constructors.rs index 40a54d1da..62b951695 100644 --- a/src/impl_constructors.rs +++ b/src/impl_constructors.rs @@ -530,7 +530,7 @@ where /// ### 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/read with the element type `A`. /// /// ### Examples /// @@ -580,10 +580,10 @@ where /// The uninitialized elements of type `A` are represented by the type `MaybeUninit`, /// an easier way to handle uninit values correctly. /// - /// The `builder` closure gets unshared access to the array through a raw view - /// and can use it to modify the array before it is returned. This allows initializing - /// the array for any owned array type (avoiding clone requirements for copy-on-write, - /// because the array is unshared when initially created). + /// The `builder` closure gets unshared access to the array through a view and can use it to + /// modify the array before it is returned. This allows initializing the array for any owned + /// array type (avoiding clone requirements for copy-on-write, because the array is unshared + /// when initially created). /// /// Only *when* the array is completely initialized with valid elements, can it be /// converted to an array of `A` elements using [`.assume_init()`]. @@ -593,17 +593,18 @@ where /// ### 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/read with the element type `A`. /// - pub(crate) fn build_uninit(shape: Sh, builder: F) -> ArrayBase + /// [`.assume_init()`]: ArrayBase::assume_init + pub fn build_uninit(shape: Sh, builder: F) -> ArrayBase where Sh: ShapeBuilder, - F: FnOnce(RawArrayViewMut, D>), + F: FnOnce(ArrayViewMut, D>), { let mut array = Self::uninit(shape); // Safe because: the array is unshared here unsafe { - builder(array.raw_view_mut_unchecked()); + builder(array.raw_view_mut_unchecked().deref_into_view_mut()); } array } diff --git a/src/zip/mod.rs b/src/zip/mod.rs index 07fcbb062..7277f99f9 100644 --- a/src/zip/mod.rs +++ b/src/zip/mod.rs @@ -745,7 +745,7 @@ macro_rules! map_impl { // Use partial to count the number of filled elements, and can drop the right // number of elements on unwinding (if it happens during apply/collect). unsafe { - let output_view = output.cast::(); + let output_view = output.into_raw_view_mut().cast::(); self.and(output_view) .collect_with_partial(f) .release_ownership();