Auto merge of #75171 - amosonn:new_zeroed_slice, r=Amanieu
New zeroed slice Add to #63291 the methods ```rust impl<T> Box<[T]> { pub fn new_zeroed_slice(len: usize) -> Box<[MaybeUninit<T>]> {…} } impl<T> Rc<[T]> { pub fn new_zeroed_slice(len: usize) -> Rc<[MaybeUninit<T>]> {…} } impl<T> Arc<[T]> { pub fn new_zeroed_slice(len: usize) -> Arc<[MaybeUninit<T>]> {…} } ``` as suggested in https://github.com/rust-lang/rust/issues/63291#issuecomment-605511675 . Also optimize `{Rc, Arc}::new_zeroed` to use `alloc_zeroed`, otherwise they are no more efficient than using `new_uninit` and zeroing the memory manually (which was the original implementation).
Showing
想要评论请 注册 或 登录