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