File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed 
src/bootstrap/src/utils/cache Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 11use  std:: path:: PathBuf ; 
22
3- use  crate :: utils:: cache:: { INTERNER ,  Internable ,  TyIntern } ; 
3+ use  crate :: utils:: cache:: { INTERNER ,  Internable ,  Interner ,   TyIntern } ; 
44
55#[ test]  
66fn  test_string_interning ( )  { 
7-     let  s1 = INTERNER . intern_str ( "Hello" ) ; 
8-     let  s2 = INTERNER . intern_str ( "Hello" ) ; 
9-     let  s3 = INTERNER . intern_str ( "world" ) ; 
7+     let  interner = Interner :: default ( ) ; 
8+     let  s1 = interner. intern_str ( "Hello" ) ; 
9+     let  s2 = interner. intern_str ( "Hello" ) ; 
10+     let  s3 = interner. intern_str ( "world" ) ; 
1011
1112    assert_eq ! ( s1,  s2,  "Same strings should be interned to the same instance" ) ; 
1213    assert_ne ! ( s1,  s3,  "Different strings should have different interned values" ) ; 
1314} 
1415
1516#[ test]  
1617fn  test_interned_equality ( )  { 
18+     // Because we compare with &str, and the Deref impl accesses the global 
19+     // INTERNER variable, we cannot use a local Interner variable here. 
1720    let  s1 = INTERNER . intern_str ( "test" ) ; 
1821    let  s2 = INTERNER . intern_str ( "test" ) ; 
1922
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments