@@ -31,9 +31,9 @@ pub(super) trait QueryDescription<'tcx>: QueryConfig {
31
31
false
32
32
}
33
33
34
- fn load_from_disk < ' a > ( _: TyCtxt < ' a , ' tcx , ' tcx > ,
35
- _: SerializedDepNodeIndex )
36
- -> Self :: Value {
34
+ fn try_load_from_disk < ' a > ( _: TyCtxt < ' a , ' tcx , ' tcx > ,
35
+ _: SerializedDepNodeIndex )
36
+ -> Option < Self :: Value > {
37
37
bug ! ( "QueryDescription::load_from_disk() called for unsupport query." )
38
38
}
39
39
}
@@ -556,12 +556,14 @@ impl<'tcx> QueryDescription<'tcx> for queries::typeck_tables_of<'tcx> {
556
556
def_id. is_local ( )
557
557
}
558
558
559
- fn load_from_disk < ' a > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
560
- id : SerializedDepNodeIndex )
561
- -> Self :: Value {
562
- let typeck_tables: ty:: TypeckTables < ' tcx > = tcx. on_disk_query_result_cache
563
- . load_query_result ( tcx, id) ;
564
- tcx. alloc_tables ( typeck_tables)
559
+ fn try_load_from_disk < ' a > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
560
+ id : SerializedDepNodeIndex )
561
+ -> Option < Self :: Value > {
562
+ let typeck_tables: Option < ty:: TypeckTables < ' tcx > > = tcx
563
+ . on_disk_query_result_cache
564
+ . try_load_query_result ( tcx, id) ;
565
+
566
+ typeck_tables. map ( |tables| tcx. alloc_tables ( tables) )
565
567
}
566
568
}
567
569
0 commit comments