Commit d34c289 1 parent 8c7a94e commit d34c289 Copy full SHA for d34c289
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 @@ -680,17 +680,12 @@ where
680
680
681
681
/// Copies the value from user memory and place it into `dest`. Afterwards,
682
682
/// `dest` will contain exactly `self.len()` elements.
683
- ///
684
- /// # Panics
685
- /// This function panics if the destination doesn't have the same size as
686
- /// the source. This can happen for dynamically-sized types such as slices.
687
683
pub fn copy_to_enclave_vec ( & self , dest : & mut Vec < T > ) {
688
- if let Some ( missing ) = self . len ( ) . checked_sub ( dest. capacity ( ) ) {
689
- dest. reserve ( missing )
690
- }
684
+ dest. clear ( ) ;
685
+ dest. reserve ( self . len ( ) ) ;
686
+ self . copy_to_enclave ( & mut dest . spare_capacity_mut ( ) [ .. self . len ( ) ] ) ;
691
687
// SAFETY: We reserve enough space above.
692
688
unsafe { dest. set_len ( self . len ( ) ) } ;
693
- self . copy_to_enclave ( & mut dest[ ..] ) ;
694
689
}
695
690
696
691
/// Copies the value from user memory into a vector in enclave memory.
You can’t perform that action at this time.
0 commit comments