File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed 
compiler/rustc_interface/src Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -18,11 +18,19 @@ use rustc_query_system::dep_graph::dep_node::default_dep_kind_debug;
1818use  rustc_query_system:: dep_graph:: { DepContext ,  DepKind ,  DepNode } ; 
1919
2020fn  track_span_parent ( def_id :  rustc_span:: def_id:: LocalDefId )  { 
21-     tls:: with_opt ( |tcx| { 
22-         if  let  Some ( tcx)  = tcx { 
23-             let  _span = tcx. source_span ( def_id) ; 
24-             // Sanity check: relative span's parent must be an absolute span. 
25-             debug_assert_eq ! ( _span. data_untracked( ) . parent,  None ) ; 
21+     tls:: with_context_opt ( |icx| { 
22+         if  let  Some ( icx)  = icx { 
23+             // `track_span_parent` gets called a lot from HIR lowering code. 
24+             // Skip doing anything if we aren't tracking dependencies. 
25+             let  tracks_deps = match  icx. task_deps  { 
26+                 TaskDepsRef :: Allow ( ..)  => true , 
27+                 TaskDepsRef :: EvalAlways  | TaskDepsRef :: Ignore  | TaskDepsRef :: Forbid  => false , 
28+             } ; 
29+             if  tracks_deps { 
30+                 let  _span = icx. tcx . source_span ( def_id) ; 
31+                 // Sanity check: relative span's parent must be an absolute span. 
32+                 debug_assert_eq ! ( _span. data_untracked( ) . parent,  None ) ; 
33+             } 
2634        } 
2735    } ) 
2836} 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments