@@ -165,113 +165,113 @@ impl<'sess> OnDiskCache<'sess> {
165165        where  E :  ty_codec:: TyEncoder 
166166     { 
167167        // Serializing the DepGraph should not modify it: 
168-         let  _in_ignore = tcx. dep_graph . in_ignore ( ) ; 
169- 
170-         // Allocate FileMapIndices 
171-         let  ( file_to_file_index,  file_index_to_stable_id)  = { 
172-             let  mut  file_to_file_index = FxHashMap ( ) ; 
173-             let  mut  file_index_to_stable_id = FxHashMap ( ) ; 
174- 
175-             for  ( index,  file)  in  tcx. sess . codemap ( ) . files ( ) . iter ( ) . enumerate ( )  { 
176-                 let  index = FileMapIndex ( index as  u32 ) ; 
177-                 let  file_ptr:  * const  FileMap  = & * * file as  * const  _ ; 
178-                 file_to_file_index. insert ( file_ptr,  index) ; 
179-                 file_index_to_stable_id. insert ( index,  StableFilemapId :: new ( & file) ) ; 
180-             } 
181- 
182-             ( file_to_file_index,  file_index_to_stable_id) 
183-         } ; 
184- 
185-         let  mut  encoder = CacheEncoder  { 
186-             tcx, 
187-             encoder, 
188-             type_shorthands :  FxHashMap ( ) , 
189-             predicate_shorthands :  FxHashMap ( ) , 
190-             expn_info_shorthands :  FxHashMap ( ) , 
191-             codemap :  CachingCodemapView :: new ( tcx. sess . codemap ( ) ) , 
192-             file_to_file_index, 
193-         } ; 
194- 
195-         // Load everything into memory so we can write it out to the on-disk 
196-         // cache. The vast majority of cacheable query results should already 
197-         // be in memory, so this should be a cheap operation. 
198-         tcx. dep_graph . exec_cache_promotions ( tcx) ; 
199- 
200-         // Encode query results 
201-         let  mut  query_result_index = EncodedQueryResultIndex :: new ( ) ; 
202- 
203-         { 
204-             use  ty:: maps:: queries:: * ; 
205-             let  enc = & mut  encoder; 
206-             let  qri = & mut  query_result_index; 
207- 
208-             // Encode TypeckTables 
209-             encode_query_results :: < typeck_tables_of ,  _ > ( tcx,  enc,  qri) ?; 
210-             encode_query_results :: < optimized_mir ,  _ > ( tcx,  enc,  qri) ?; 
211-             encode_query_results :: < unsafety_check_result ,  _ > ( tcx,  enc,  qri) ?; 
212-             encode_query_results :: < borrowck ,  _ > ( tcx,  enc,  qri) ?; 
213-             encode_query_results :: < mir_borrowck ,  _ > ( tcx,  enc,  qri) ?; 
214-             encode_query_results :: < mir_const_qualif ,  _ > ( tcx,  enc,  qri) ?; 
215-             encode_query_results :: < def_symbol_name ,  _ > ( tcx,  enc,  qri) ?; 
216-             encode_query_results :: < const_is_rvalue_promotable_to_static ,  _ > ( tcx,  enc,  qri) ?; 
217-             encode_query_results :: < contains_extern_indicator ,  _ > ( tcx,  enc,  qri) ?; 
218-             encode_query_results :: < symbol_name ,  _ > ( tcx,  enc,  qri) ?; 
219-             encode_query_results :: < trans_fulfill_obligation ,  _ > ( tcx,  enc,  qri) ?; 
220-             encode_query_results :: < check_match ,  _ > ( tcx,  enc,  qri) ?; 
221-         } 
168+         tcx. dep_graph . with_ignore ( || { 
169+             // Allocate FileMapIndices 
170+             let  ( file_to_file_index,  file_index_to_stable_id)  = { 
171+                 let  mut  file_to_file_index = FxHashMap ( ) ; 
172+                 let  mut  file_index_to_stable_id = FxHashMap ( ) ; 
173+ 
174+                 for  ( index,  file)  in  tcx. sess . codemap ( ) . files ( ) . iter ( ) . enumerate ( )  { 
175+                     let  index = FileMapIndex ( index as  u32 ) ; 
176+                     let  file_ptr:  * const  FileMap  = & * * file as  * const  _ ; 
177+                     file_to_file_index. insert ( file_ptr,  index) ; 
178+                     file_index_to_stable_id. insert ( index,  StableFilemapId :: new ( & file) ) ; 
179+                 } 
222180
223-         // Encode diagnostics 
224-         let  diagnostics_index = { 
225-             let  mut  diagnostics_index = EncodedDiagnosticsIndex :: new ( ) ; 
226- 
227-             for  ( dep_node_index,  diagnostics)  in  self . current_diagnostics 
228-                                                      . borrow ( ) 
229-                                                      . iter ( )  { 
230-                 let  pos = AbsoluteBytePos :: new ( encoder. position ( ) ) ; 
231-                 // Let's make sure we get the expected type here: 
232-                 let  diagnostics:  & EncodedDiagnostics  = diagnostics; 
233-                 let  dep_node_index =
234-                     SerializedDepNodeIndex :: new ( dep_node_index. index ( ) ) ; 
235-                 encoder. encode_tagged ( dep_node_index,  diagnostics) ?; 
236-                 diagnostics_index. push ( ( dep_node_index,  pos) ) ; 
181+                 ( file_to_file_index,  file_index_to_stable_id) 
182+             } ; 
183+ 
184+             let  mut  encoder = CacheEncoder  { 
185+                 tcx, 
186+                 encoder, 
187+                 type_shorthands :  FxHashMap ( ) , 
188+                 predicate_shorthands :  FxHashMap ( ) , 
189+                 expn_info_shorthands :  FxHashMap ( ) , 
190+                 codemap :  CachingCodemapView :: new ( tcx. sess . codemap ( ) ) , 
191+                 file_to_file_index, 
192+             } ; 
193+ 
194+             // Load everything into memory so we can write it out to the on-disk 
195+             // cache. The vast majority of cacheable query results should already 
196+             // be in memory, so this should be a cheap operation. 
197+             tcx. dep_graph . exec_cache_promotions ( tcx) ; 
198+ 
199+             // Encode query results 
200+             let  mut  query_result_index = EncodedQueryResultIndex :: new ( ) ; 
201+ 
202+             { 
203+                 use  ty:: maps:: queries:: * ; 
204+                 let  enc = & mut  encoder; 
205+                 let  qri = & mut  query_result_index; 
206+ 
207+                 // Encode TypeckTables 
208+                 encode_query_results :: < typeck_tables_of ,  _ > ( tcx,  enc,  qri) ?; 
209+                 encode_query_results :: < optimized_mir ,  _ > ( tcx,  enc,  qri) ?; 
210+                 encode_query_results :: < unsafety_check_result ,  _ > ( tcx,  enc,  qri) ?; 
211+                 encode_query_results :: < borrowck ,  _ > ( tcx,  enc,  qri) ?; 
212+                 encode_query_results :: < mir_borrowck ,  _ > ( tcx,  enc,  qri) ?; 
213+                 encode_query_results :: < mir_const_qualif ,  _ > ( tcx,  enc,  qri) ?; 
214+                 encode_query_results :: < def_symbol_name ,  _ > ( tcx,  enc,  qri) ?; 
215+                 encode_query_results :: < const_is_rvalue_promotable_to_static ,  _ > ( tcx,  enc,  qri) ?; 
216+                 encode_query_results :: < contains_extern_indicator ,  _ > ( tcx,  enc,  qri) ?; 
217+                 encode_query_results :: < symbol_name ,  _ > ( tcx,  enc,  qri) ?; 
218+                 encode_query_results :: < trans_fulfill_obligation ,  _ > ( tcx,  enc,  qri) ?; 
219+                 encode_query_results :: < check_match ,  _ > ( tcx,  enc,  qri) ?; 
237220            } 
238221
239-             diagnostics_index
240-         } ; 
222+             // Encode diagnostics 
223+             let  diagnostics_index = { 
224+                 let  mut  diagnostics_index = EncodedDiagnosticsIndex :: new ( ) ; 
225+ 
226+                 for  ( dep_node_index,  diagnostics)  in  self . current_diagnostics 
227+                                                         . borrow ( ) 
228+                                                         . iter ( )  { 
229+                     let  pos = AbsoluteBytePos :: new ( encoder. position ( ) ) ; 
230+                     // Let's make sure we get the expected type here: 
231+                     let  diagnostics:  & EncodedDiagnostics  = diagnostics; 
232+                     let  dep_node_index =
233+                         SerializedDepNodeIndex :: new ( dep_node_index. index ( ) ) ; 
234+                     encoder. encode_tagged ( dep_node_index,  diagnostics) ?; 
235+                     diagnostics_index. push ( ( dep_node_index,  pos) ) ; 
236+                 } 
241237
242-         let  sorted_cnums = sorted_cnums_including_local_crate ( tcx) ; 
243-         let  prev_cnums:  Vec < _ >  = sorted_cnums. iter ( ) . map ( |& cnum| { 
244-             let  crate_name = tcx. original_crate_name ( cnum) . as_str ( ) . to_string ( ) ; 
245-             let  crate_disambiguator = tcx. crate_disambiguator ( cnum) ; 
246-             ( cnum. as_u32 ( ) ,  crate_name,  crate_disambiguator) 
247-         } ) . collect ( ) ; 
248- 
249-         // Encode the file footer 
250-         let  footer_pos = encoder. position ( )  as  u64 ; 
251-         encoder. encode_tagged ( TAG_FILE_FOOTER ,  & Footer  { 
252-             file_index_to_stable_id, 
253-             prev_cnums, 
254-             query_result_index, 
255-             diagnostics_index, 
256-         } ) ?; 
257- 
258-         // Encode the position of the footer as the last 8 bytes of the 
259-         // file so we know where to look for it. 
260-         IntEncodedWithFixedSize ( footer_pos) . encode ( encoder. encoder ) ?; 
261- 
262-         // DO NOT WRITE ANYTHING TO THE ENCODER AFTER THIS POINT! The address 
263-         // of the footer must be the last thing in the data stream. 
264- 
265-         return  Ok ( ( ) ) ; 
266- 
267-         fn  sorted_cnums_including_local_crate ( tcx :  TyCtxt )  -> Vec < CrateNum >  { 
268-             let  mut  cnums = vec ! [ LOCAL_CRATE ] ; 
269-             cnums. extend_from_slice ( & tcx. crates ( ) [ ..] ) ; 
270-             cnums. sort_unstable ( ) ; 
271-             // Just to be sure... 
272-             cnums. dedup ( ) ; 
273-             cnums
274-         } 
238+                 diagnostics_index
239+             } ; 
240+ 
241+             let  sorted_cnums = sorted_cnums_including_local_crate ( tcx) ; 
242+             let  prev_cnums:  Vec < _ >  = sorted_cnums. iter ( ) . map ( |& cnum| { 
243+                 let  crate_name = tcx. original_crate_name ( cnum) . as_str ( ) . to_string ( ) ; 
244+                 let  crate_disambiguator = tcx. crate_disambiguator ( cnum) ; 
245+                 ( cnum. as_u32 ( ) ,  crate_name,  crate_disambiguator) 
246+             } ) . collect ( ) ; 
247+ 
248+             // Encode the file footer 
249+             let  footer_pos = encoder. position ( )  as  u64 ; 
250+             encoder. encode_tagged ( TAG_FILE_FOOTER ,  & Footer  { 
251+                 file_index_to_stable_id, 
252+                 prev_cnums, 
253+                 query_result_index, 
254+                 diagnostics_index, 
255+             } ) ?; 
256+ 
257+             // Encode the position of the footer as the last 8 bytes of the 
258+             // file so we know where to look for it. 
259+             IntEncodedWithFixedSize ( footer_pos) . encode ( encoder. encoder ) ?; 
260+ 
261+             // DO NOT WRITE ANYTHING TO THE ENCODER AFTER THIS POINT! The address 
262+             // of the footer must be the last thing in the data stream. 
263+ 
264+             return  Ok ( ( ) ) ; 
265+ 
266+             fn  sorted_cnums_including_local_crate ( tcx :  TyCtxt )  -> Vec < CrateNum >  { 
267+                 let  mut  cnums = vec ! [ LOCAL_CRATE ] ; 
268+                 cnums. extend_from_slice ( & tcx. crates ( ) [ ..] ) ; 
269+                 cnums. sort_unstable ( ) ; 
270+                 // Just to be sure... 
271+                 cnums. dedup ( ) ; 
272+                 cnums
273+             } 
274+         } ) 
275275    } 
276276
277277    /// Load a diagnostic emitted during the previous compilation session. 
@@ -380,30 +380,30 @@ impl<'sess> OnDiskCache<'sess> {
380380                        prev_cnums :  & [ ( u32 ,  String ,  CrateDisambiguator ) ] ) 
381381                        -> IndexVec < CrateNum ,  Option < CrateNum > > 
382382    { 
383-         let  _in_ignore = tcx. dep_graph . in_ignore ( ) ; 
384- 
385-         let  current_cnums = tcx. all_crate_nums ( LOCAL_CRATE ) . iter ( ) . map ( |& cnum| { 
386-             let  crate_name = tcx. original_crate_name ( cnum) 
387-                                 . as_str ( ) 
388-                                 . to_string ( ) ; 
389-             let  crate_disambiguator = tcx. crate_disambiguator ( cnum) ; 
390-             ( ( crate_name,  crate_disambiguator) ,  cnum) 
391-         } ) . collect :: < FxHashMap < _ , _ > > ( ) ; 
392- 
393-         let  map_size = prev_cnums. iter ( ) 
394-                                  . map ( |& ( cnum,  ..) | cnum) 
395-                                  . max ( ) 
396-                                  . unwrap_or ( 0 )  + 1 ; 
397-         let  mut  map = IndexVec :: new ( ) ; 
398-         map. resize ( map_size as  usize ,  None ) ; 
399- 
400-         for  & ( prev_cnum,  ref  crate_name,  crate_disambiguator)  in  prev_cnums { 
401-             let  key = ( crate_name. clone ( ) ,  crate_disambiguator) ; 
402-             map[ CrateNum :: from_u32 ( prev_cnum) ]  = current_cnums. get ( & key) . cloned ( ) ; 
403-         } 
383+         tcx. dep_graph . with_ignore ( || { 
384+             let  current_cnums = tcx. all_crate_nums ( LOCAL_CRATE ) . iter ( ) . map ( |& cnum| { 
385+                 let  crate_name = tcx. original_crate_name ( cnum) 
386+                                     . as_str ( ) 
387+                                     . to_string ( ) ; 
388+                 let  crate_disambiguator = tcx. crate_disambiguator ( cnum) ; 
389+                 ( ( crate_name,  crate_disambiguator) ,  cnum) 
390+             } ) . collect :: < FxHashMap < _ , _ > > ( ) ; 
391+ 
392+             let  map_size = prev_cnums. iter ( ) 
393+                                     . map ( |& ( cnum,  ..) | cnum) 
394+                                     . max ( ) 
395+                                     . unwrap_or ( 0 )  + 1 ; 
396+             let  mut  map = IndexVec :: new ( ) ; 
397+             map. resize ( map_size as  usize ,  None ) ; 
398+ 
399+             for  & ( prev_cnum,  ref  crate_name,  crate_disambiguator)  in  prev_cnums { 
400+                 let  key = ( crate_name. clone ( ) ,  crate_disambiguator) ; 
401+                 map[ CrateNum :: from_u32 ( prev_cnum) ]  = current_cnums. get ( & key) . cloned ( ) ; 
402+             } 
404403
405-         map[ LOCAL_CRATE ]  = Some ( LOCAL_CRATE ) ; 
406-         map
404+             map[ LOCAL_CRATE ]  = Some ( LOCAL_CRATE ) ; 
405+             map
406+         } ) 
407407    } 
408408} 
409409
0 commit comments