File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -3109,17 +3109,25 @@ impl Hash for Path {
31093109                    bytes_hashed += to_hash. len ( ) ; 
31103110                } 
31113111
3112-                 // skip  over separator  and optionally a following CurDir item 
3112+                 // Skip  over separators  and,  optionally,  a following CurDir item 
31133113                // since components() would normalize these away. 
31143114                component_start = i + 1 ; 
31153115
31163116                let  tail = & bytes[ component_start..] ; 
31173117
31183118                if  !verbatim { 
31193119                    component_start += match  tail { 
3120+                         [ ]  => 0 ,  // Do not hash a trailing separator 
31203121                        [ b'.' ]  => 1 , 
31213122                        [ b'.' ,  sep @ _,  ..]  if  is_sep_byte ( * sep)  => 1 , 
3122-                         _ => 0 , 
3123+                         _ => { 
3124+                             // Hash the first separator so we can distinguish between 
3125+                             // `foo/bar` and `foobar` 
3126+                             let  to_hash = & [ b'/'  as  u8 ] ; 
3127+                             h. write ( to_hash) ; 
3128+                             bytes_hashed += to_hash. len ( ) ; 
3129+                             0 
3130+                         } 
31233131                    } ; 
31243132                } 
31253133            } 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments