File tree Expand file tree Collapse file tree 2 files changed +4
-12
lines changed
Expand file tree Collapse file tree 2 files changed +4
-12
lines changed Original file line number Diff line number Diff line change @@ -495,10 +495,8 @@ impl<T> Rc<mem::MaybeUninit<T>> {
495495 #[ unstable( feature = "new_uninit" , issue = "0" ) ]
496496 #[ inline]
497497 pub unsafe fn assume_init ( self ) -> Rc < T > {
498- let ptr = self . ptr . cast ( ) ;
499- mem:: forget ( self ) ;
500498 Rc {
501- ptr,
499+ ptr : mem :: ManuallyDrop :: new ( self ) . ptr . cast ( ) ,
502500 phantom : PhantomData ,
503501 }
504502 }
@@ -541,10 +539,8 @@ impl<T> Rc<[mem::MaybeUninit<T>]> {
541539 #[ unstable( feature = "new_uninit" , issue = "0" ) ]
542540 #[ inline]
543541 pub unsafe fn assume_init ( self ) -> Rc < [ T ] > {
544- let ptr = NonNull :: new_unchecked ( self . ptr . as_ptr ( ) as _ ) ;
545- mem:: forget ( self ) ;
546542 Rc {
547- ptr,
543+ ptr : NonNull :: new_unchecked ( mem :: ManuallyDrop :: new ( self ) . ptr . as_ptr ( ) as _ ) ,
548544 phantom : PhantomData ,
549545 }
550546 }
Original file line number Diff line number Diff line change @@ -479,10 +479,8 @@ impl<T> Arc<mem::MaybeUninit<T>> {
479479 #[ unstable( feature = "new_uninit" , issue = "0" ) ]
480480 #[ inline]
481481 pub unsafe fn assume_init ( self ) -> Arc < T > {
482- let ptr = self . ptr . cast ( ) ;
483- mem:: forget ( self ) ;
484482 Arc {
485- ptr,
483+ ptr : mem :: ManuallyDrop :: new ( self ) . ptr . cast ( ) ,
486484 phantom : PhantomData ,
487485 }
488486 }
@@ -525,10 +523,8 @@ impl<T> Arc<[mem::MaybeUninit<T>]> {
525523 #[ unstable( feature = "new_uninit" , issue = "0" ) ]
526524 #[ inline]
527525 pub unsafe fn assume_init ( self ) -> Arc < [ T ] > {
528- let ptr = NonNull :: new_unchecked ( self . ptr . as_ptr ( ) as _ ) ;
529- mem:: forget ( self ) ;
530526 Arc {
531- ptr,
527+ ptr : NonNull :: new_unchecked ( mem :: ManuallyDrop :: new ( self ) . ptr . as_ptr ( ) as _ ) ,
532528 phantom : PhantomData ,
533529 }
534530 }
You can’t perform that action at this time.
0 commit comments