diff options
| author | Alex Saveau <saveau.alexandre@gmail.com> | 2022-10-16 21:01:28 -0700 |
|---|---|---|
| committer | Alex Saveau <saveau.alexandre@gmail.com> | 2022-10-17 13:03:54 -0700 |
| commit | 55d71c61b8797117ba0efa972514451a29c69c28 (patch) | |
| tree | 822e4ffc1b40b9f573f341e6d6861e2f3ef71bc6 /library/core/src/array | |
| parent | 8be3ce9056d17f822704b8994f60668adf180fe8 (diff) | |
| download | rust-55d71c61b8797117ba0efa972514451a29c69c28.tar.gz rust-55d71c61b8797117ba0efa972514451a29c69c28.zip | |
Remove all uses of array_assume_init
Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
Diffstat (limited to 'library/core/src/array')
| -rw-r--r-- | library/core/src/array/iter.rs | 5 | ||||
| -rw-r--r-- | library/core/src/array/mod.rs | 2 |
2 files changed, 3 insertions, 4 deletions
diff --git a/library/core/src/array/iter.rs b/library/core/src/array/iter.rs index b3b26040067..b91c630183d 100644 --- a/library/core/src/array/iter.rs +++ b/library/core/src/array/iter.rs @@ -104,8 +104,7 @@ impl<T, const N: usize> IntoIter<T, N> { /// /// ``` /// #![feature(array_into_iter_constructors)] - /// - /// #![feature(maybe_uninit_array_assume_init)] + /// #![feature(maybe_uninit_uninit_array_transpose)] /// #![feature(maybe_uninit_uninit_array)] /// use std::array::IntoIter; /// use std::mem::MaybeUninit; @@ -134,7 +133,7 @@ impl<T, const N: usize> IntoIter<T, N> { /// } /// /// // SAFETY: We've initialized all N items - /// unsafe { Ok(MaybeUninit::array_assume_init(buffer)) } + /// unsafe { Ok(buffer.transpose().assume_init()) } /// } /// /// let r: [_; 4] = next_chunk(&mut (10..16)).unwrap(); diff --git a/library/core/src/array/mod.rs b/library/core/src/array/mod.rs index b82bbf2267a..04dd821efde 100644 --- a/library/core/src/array/mod.rs +++ b/library/core/src/array/mod.rs @@ -912,7 +912,7 @@ where mem::forget(guard); // SAFETY: All elements of the array were populated in the loop above. - let output = unsafe { MaybeUninit::array_assume_init(array) }; + let output = unsafe { array.transpose().assume_init() }; Ok(Try::from_output(output)) } |
