File tree 1 file changed +3
-8
lines changed
library/std/src/sys/pal/sgx/abi/usercalls
1 file changed +3
-8
lines changed Original file line number Diff line number Diff line change @@ -645,17 +645,12 @@ where
645
645
646
646
/// Copies the value from user memory and place it into `dest`. Afterwards,
647
647
/// `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.
652
648
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 ( ) ] ) ;
656
652
// SAFETY: We reserve enough space above.
657
653
unsafe { dest. set_len ( self . len ( ) ) } ;
658
- self . copy_to_enclave ( & mut dest[ ..] ) ;
659
654
}
660
655
661
656
/// Copies the value from user memory and place it into `dest`.
You can’t perform that action at this time.
0 commit comments