@@ -239,14 +239,12 @@ impl<'sess> OnDiskCache<'sess> {
239239 def_path_hash_to_def_id_cache : Default :: default ( ) ,
240240 }
241241 }
242+ }
242243
243- crate fn serialize < ' tcx > (
244- & self ,
245- tcx : TyCtxt < ' tcx > ,
246- encoder : & mut opaque:: Encoder ,
247- ) -> Result < ( ) , !> {
244+ impl < ' tcx > rustc_query_system:: dep_graph:: OnDiskCache < TyCtxt < ' tcx > > for OnDiskCache < ' tcx > {
245+ fn serialize ( & self , tcx : TyCtxt < ' tcx > , encoder : & mut opaque:: Encoder ) {
248246 // Serializing the `DepGraph` should not modify it.
249- tcx. dep_graph . with_ignore ( || {
247+ let ret : Result < ( ) , ! > = tcx. dep_graph . with_ignore ( || {
250248 // Allocate `SourceFileIndex`es.
251249 let ( file_to_file_index, file_index_to_stable_id) = {
252250 let files = tcx. sess . source_map ( ) . files ( ) ;
@@ -418,11 +416,12 @@ impl<'sess> OnDiskCache<'sess> {
418416 cnums. dedup ( ) ;
419417 cnums
420418 }
421- } )
419+ } ) ;
420+ ret. unwrap ( )
422421 }
423422
424423 /// Loads a diagnostic emitted during the previous compilation session.
425- crate fn load_diagnostics (
424+ fn load_diagnostics (
426425 & self ,
427426 tcx : TyCtxt < ' _ > ,
428427 dep_node_index : SerializedDepNodeIndex ,
@@ -438,16 +437,32 @@ impl<'sess> OnDiskCache<'sess> {
438437 /// the next compilation session.
439438 #[ inline( never) ]
440439 #[ cold]
441- crate fn store_diagnostics (
440+ fn store_diagnostics ( & self , dep_node_index : DepNodeIndex , diagnostics : ThinVec < Diagnostic > ) {
441+ let mut current_diagnostics = self . current_diagnostics . borrow_mut ( ) ;
442+ let prev = current_diagnostics. insert ( dep_node_index, diagnostics. into ( ) ) ;
443+ debug_assert ! ( prev. is_none( ) ) ;
444+ }
445+
446+ /// Stores a diagnostic emitted during computation of an anonymous query.
447+ /// Since many anonymous queries can share the same `DepNode`, we aggregate
448+ /// them -- as opposed to regular queries where we assume that there is a
449+ /// 1:1 relationship between query-key and `DepNode`.
450+ #[ inline( never) ]
451+ #[ cold]
452+ fn store_diagnostics_for_anon_node (
442453 & self ,
443454 dep_node_index : DepNodeIndex ,
444455 diagnostics : ThinVec < Diagnostic > ,
445456 ) {
446457 let mut current_diagnostics = self . current_diagnostics . borrow_mut ( ) ;
447- let prev = current_diagnostics. insert ( dep_node_index, diagnostics. into ( ) ) ;
448- debug_assert ! ( prev. is_none( ) ) ;
458+
459+ let x = current_diagnostics. entry ( dep_node_index) . or_insert ( Vec :: new ( ) ) ;
460+
461+ x. extend ( Into :: < Vec < _ > > :: into ( diagnostics) ) ;
449462 }
463+ }
450464
465+ impl < ' sess > OnDiskCache < ' sess > {
451466 fn get_raw_def_id ( & self , hash : & DefPathHash ) -> Option < RawDefId > {
452467 self . foreign_def_path_hashes . get ( hash) . copied ( )
453468 }
@@ -500,24 +515,6 @@ impl<'sess> OnDiskCache<'sess> {
500515 self . load_indexed ( tcx, dep_node_index, & self . query_result_index , "query result" )
501516 }
502517
503- /// Stores a diagnostic emitted during computation of an anonymous query.
504- /// Since many anonymous queries can share the same `DepNode`, we aggregate
505- /// them -- as opposed to regular queries where we assume that there is a
506- /// 1:1 relationship between query-key and `DepNode`.
507- #[ inline( never) ]
508- #[ cold]
509- crate fn store_diagnostics_for_anon_node (
510- & self ,
511- dep_node_index : DepNodeIndex ,
512- diagnostics : ThinVec < Diagnostic > ,
513- ) {
514- let mut current_diagnostics = self . current_diagnostics . borrow_mut ( ) ;
515-
516- let x = current_diagnostics. entry ( dep_node_index) . or_insert ( Vec :: new ( ) ) ;
517-
518- x. extend ( Into :: < Vec < _ > > :: into ( diagnostics) ) ;
519- }
520-
521518 fn load_indexed < ' tcx , T > (
522519 & self ,
523520 tcx : TyCtxt < ' tcx > ,
0 commit comments