File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change 3838 const_maybe_uninit_assume_init,
3939 const_maybe_uninit_assume_init_read,
4040 const_maybe_uninit_uninit_array,
41+ const_maybe_uninit_zeroed,
4142 const_mut_refs,
4243 const_precise_live_drops,
4344 const_ptr_is_null,
@@ -2689,6 +2690,12 @@ impl<const N: usize> StaticVec<u8, N> {
26892690 res[ i] = MaybeUninit :: new ( values[ i] ) ;
26902691 i += 1 ;
26912692 }
2693+ // Fill in any remaining "gaps", or do nothing if `values.len()` is the same as `N`.
2694+ let mut i = values. len ( ) ;
2695+ while i < N {
2696+ res[ i] = MaybeUninit :: zeroed ( ) ;
2697+ i += 1 ;
2698+ }
26922699 // Convert `res` from an instance of `[MaybeUninit<u8>; N]` to one of `[u8; N]`, and then return
26932700 // it as an instance of `MaybeUninit<[u8; N]>` that can be used to construct a `StaticVec`.
26942701 MaybeUninit :: new ( unsafe { MaybeUninit :: array_assume_init ( res) } )
You can’t perform that action at this time.
0 commit comments