File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -568,18 +568,17 @@ where
568568 fn drop ( & mut self ) {
569569 debug_assert ! ( self . initialized <= N ) ;
570570
571- let ptr = MaybeUninit :: slice_as_mut_ptr ( self . array_mut ) ;
572- let initialized_part = crate :: ptr:: slice_from_raw_parts_mut ( ptr, self . initialized ) ;
573-
574- // SAFETY: this raw slice will contain only initialized objects.
571+ // SAFETY: this slice will contain only initialized objects.
575572 unsafe {
576- crate :: ptr:: drop_in_place ( initialized_part) ;
573+ crate :: ptr:: drop_in_place ( MaybeUninit :: slice_assume_init_mut (
574+ & mut self . array_mut . get_unchecked_mut ( ..self . initialized ) ,
575+ ) ) ;
577576 }
578577 }
579578 }
580579
581580 let mut array = MaybeUninit :: uninit_array :: < N > ( ) ;
582- let mut guard: Guard < ' _ , _ , N > = Guard { array_mut : & mut array, initialized : 0 } ;
581+ let mut guard = Guard { array_mut : & mut array, initialized : 0 } ;
583582
584583 while let Some ( item_rslt) = iter. next ( ) {
585584 let item = match item_rslt {
You can’t perform that action at this time.
0 commit comments