File tree Expand file tree Collapse file tree 1 file changed +3
-8
lines changed
library/std/src/sys/pal/sgx/abi/usercalls Expand file tree Collapse file tree 1 file changed +3
-8
lines changed Original file line number Diff line number Diff line change @@ -645,17 +645,12 @@ where
645645
646646 /// Copies the value from user memory and place it into `dest`. Afterwards,
647647 /// `dest` will contain exactly `self.len()` elements.
648- ///
649- /// # Panics
650- /// This function panics if the destination doesn't have the same size as
651- /// the source. This can happen for dynamically-sized types such as slices.
652648 pub fn copy_to_enclave_vec ( & self , dest : & mut Vec < T > ) {
653- if let Some ( missing ) = self . len ( ) . checked_sub ( dest. capacity ( ) ) {
654- dest. reserve ( missing )
655- }
649+ dest. clear ( ) ;
650+ dest. reserve ( self . len ( ) ) ;
651+ self . copy_to_enclave_uninit ( & mut dest . spare_capacity_mut ( ) [ .. self . len ( ) ] ) ;
656652 // SAFETY: We reserve enough space above.
657653 unsafe { dest. set_len ( self . len ( ) ) } ;
658- self . copy_to_enclave ( & mut dest[ ..] ) ;
659654 }
660655
661656 /// Copies the value from user memory and place it into `dest`.
You can’t perform that action at this time.
0 commit comments