@@ -239,14 +239,12 @@ impl<'sess> OnDiskCache<'sess> {
239
239
def_path_hash_to_def_id_cache : Default :: default ( ) ,
240
240
}
241
241
}
242
+ }
242
243
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 ) {
248
246
// Serializing the `DepGraph` should not modify it.
249
- tcx. dep_graph . with_ignore ( || {
247
+ let ret : Result < ( ) , ! > = tcx. dep_graph . with_ignore ( || {
250
248
// Allocate `SourceFileIndex`es.
251
249
let ( file_to_file_index, file_index_to_stable_id) = {
252
250
let files = tcx. sess . source_map ( ) . files ( ) ;
@@ -418,11 +416,12 @@ impl<'sess> OnDiskCache<'sess> {
418
416
cnums. dedup ( ) ;
419
417
cnums
420
418
}
421
- } )
419
+ } ) ;
420
+ ret. unwrap ( )
422
421
}
423
422
424
423
/// Loads a diagnostic emitted during the previous compilation session.
425
- crate fn load_diagnostics (
424
+ fn load_diagnostics (
426
425
& self ,
427
426
tcx : TyCtxt < ' _ > ,
428
427
dep_node_index : SerializedDepNodeIndex ,
@@ -438,16 +437,32 @@ impl<'sess> OnDiskCache<'sess> {
438
437
/// the next compilation session.
439
438
#[ inline( never) ]
440
439
#[ 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 (
442
453
& self ,
443
454
dep_node_index : DepNodeIndex ,
444
455
diagnostics : ThinVec < Diagnostic > ,
445
456
) {
446
457
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) ) ;
449
462
}
463
+ }
450
464
465
+ impl < ' sess > OnDiskCache < ' sess > {
451
466
fn get_raw_def_id ( & self , hash : & DefPathHash ) -> Option < RawDefId > {
452
467
self . foreign_def_path_hashes . get ( hash) . copied ( )
453
468
}
@@ -500,24 +515,6 @@ impl<'sess> OnDiskCache<'sess> {
500
515
self . load_indexed ( tcx, dep_node_index, & self . query_result_index , "query result" )
501
516
}
502
517
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
-
521
518
fn load_indexed < ' tcx , T > (
522
519
& self ,
523
520
tcx : TyCtxt < ' tcx > ,
0 commit comments