@@ -59,6 +59,7 @@ rustc_queries! {
59
59
query hir_module_items( key: LocalDefId ) -> rustc_middle:: hir:: ModuleItems {
60
60
storage( ArenaCacheSelector <' tcx>)
61
61
desc { |tcx| "HIR module items in `{}`" , tcx. def_path_str( key. to_def_id( ) ) }
62
+ cache_on_disk_if { true }
62
63
}
63
64
64
65
/// Gives access to the HIR node for the HIR owner `key`.
@@ -128,6 +129,7 @@ rustc_queries! {
128
129
/// parameter. e.g. `fn example<const N: usize=3>` called on `N` would return `3`.
129
130
query const_param_default( param: DefId ) -> ty:: Const <' tcx> {
130
131
desc { |tcx| "compute const default for a given parameter `{}`" , tcx. def_path_str( param) }
132
+ cache_on_disk_if { param. is_local( ) }
131
133
separate_provide_extern
132
134
}
133
135
@@ -223,6 +225,7 @@ rustc_queries! {
223
225
/// Bounds from the parent (e.g. with nested impl trait) are not included.
224
226
query explicit_item_bounds( key: DefId ) -> & ' tcx [ ( ty:: Predicate <' tcx>, Span ) ] {
225
227
desc { |tcx| "finding item bounds for `{}`" , tcx. def_path_str( key) }
228
+ cache_on_disk_if { key. is_local( ) }
226
229
separate_provide_extern
227
230
}
228
231
@@ -508,13 +511,15 @@ rustc_queries! {
508
511
/// Returns the predicates written explicitly by the user.
509
512
query explicit_predicates_of( key: DefId ) -> ty:: GenericPredicates <' tcx> {
510
513
desc { |tcx| "computing explicit predicates of `{}`" , tcx. def_path_str( key) }
514
+ cache_on_disk_if { key. is_local( ) }
511
515
separate_provide_extern
512
516
}
513
517
514
518
/// Returns the inferred outlives predicates (e.g., for `struct
515
519
/// Foo<'a, T> { x: &'a T }`, this would return `T: 'a`).
516
520
query inferred_outlives_of( key: DefId ) -> & ' tcx [ ( ty:: Predicate <' tcx>, Span ) ] {
517
521
desc { |tcx| "computing inferred outlives predicates of `{}`" , tcx. def_path_str( key) }
522
+ cache_on_disk_if { key. is_local( ) }
518
523
separate_provide_extern
519
524
}
520
525
@@ -526,6 +531,7 @@ rustc_queries! {
526
531
/// additional acyclicity requirements).
527
532
query super_predicates_of( key: DefId ) -> ty:: GenericPredicates <' tcx> {
528
533
desc { |tcx| "computing the super predicates of `{}`" , tcx. def_path_str( key) }
534
+ cache_on_disk_if { key. is_local( ) }
529
535
separate_provide_extern
530
536
}
531
537
@@ -549,6 +555,7 @@ rustc_queries! {
549
555
query trait_def( key: DefId ) -> ty:: TraitDef {
550
556
desc { |tcx| "computing trait definition for `{}`" , tcx. def_path_str( key) }
551
557
storage( ArenaCacheSelector <' tcx>)
558
+ cache_on_disk_if { key. is_local( ) }
552
559
separate_provide_extern
553
560
}
554
561
query adt_def( key: DefId ) -> ty:: AdtDef <' tcx> {
@@ -558,6 +565,7 @@ rustc_queries! {
558
565
}
559
566
query adt_destructor( key: DefId ) -> Option <ty:: Destructor > {
560
567
desc { |tcx| "computing `Drop` impl for `{}`" , tcx. def_path_str( key) }
568
+ cache_on_disk_if { key. is_local( ) }
561
569
separate_provide_extern
562
570
}
563
571
@@ -587,11 +595,13 @@ rustc_queries! {
587
595
/// `is_const_fn` function.
588
596
query impl_constness( key: DefId ) -> hir:: Constness {
589
597
desc { |tcx| "checking if item is const fn: `{}`" , tcx. def_path_str( key) }
598
+ cache_on_disk_if { key. is_local( ) }
590
599
separate_provide_extern
591
600
}
592
601
593
602
query asyncness( key: DefId ) -> hir:: IsAsync {
594
603
desc { |tcx| "checking if the function is async: `{}`" , tcx. def_path_str( key) }
604
+ cache_on_disk_if { key. is_local( ) }
595
605
separate_provide_extern
596
606
}
597
607
@@ -609,12 +619,14 @@ rustc_queries! {
609
619
/// Returns `true` if this is a foreign item (i.e., linked via `extern { ... }`).
610
620
query is_foreign_item( key: DefId ) -> bool {
611
621
desc { |tcx| "checking if `{}` is a foreign item" , tcx. def_path_str( key) }
622
+ cache_on_disk_if { key. is_local( ) }
612
623
separate_provide_extern
613
624
}
614
625
615
626
/// Returns `Some(generator_kind)` if the node pointed to by `def_id` is a generator.
616
627
query generator_kind( def_id: DefId ) -> Option <hir:: GeneratorKind > {
617
628
desc { |tcx| "looking up generator kind of `{}`" , tcx. def_path_str( def_id) }
629
+ cache_on_disk_if { def_id. is_local( ) }
618
630
separate_provide_extern
619
631
}
620
632
@@ -627,6 +639,7 @@ rustc_queries! {
627
639
/// Maps from the `DefId` of a type or region parameter to its (inferred) variance.
628
640
query variances_of( def_id: DefId ) -> & ' tcx [ ty:: Variance ] {
629
641
desc { |tcx| "computing the variances of `{}`" , tcx. def_path_str( def_id) }
642
+ cache_on_disk_if { def_id. is_local( ) }
630
643
separate_provide_extern
631
644
}
632
645
@@ -639,13 +652,15 @@ rustc_queries! {
639
652
/// Maps from an impl/trait `DefId` to a list of the `DefId`s of its items.
640
653
query associated_item_def_ids( key: DefId ) -> & ' tcx [ DefId ] {
641
654
desc { |tcx| "collecting associated items of `{}`" , tcx. def_path_str( key) }
655
+ cache_on_disk_if { key. is_local( ) }
642
656
separate_provide_extern
643
657
}
644
658
645
659
/// Maps from a trait item to the trait item "descriptor".
646
660
query associated_item( key: DefId ) -> ty:: AssocItem {
647
661
desc { |tcx| "computing associated item data for `{}`" , tcx. def_path_str( key) }
648
662
storage( ArenaCacheSelector <' tcx>)
663
+ cache_on_disk_if { key. is_local( ) }
649
664
separate_provide_extern
650
665
}
651
666
@@ -685,10 +700,12 @@ rustc_queries! {
685
700
/// Return `None` if this is an inherent impl.
686
701
query impl_trait_ref( impl_id: DefId ) -> Option <ty:: TraitRef <' tcx>> {
687
702
desc { |tcx| "computing trait implemented by `{}`" , tcx. def_path_str( impl_id) }
703
+ cache_on_disk_if { impl_id. is_local( ) }
688
704
separate_provide_extern
689
705
}
690
706
query impl_polarity( impl_id: DefId ) -> ty:: ImplPolarity {
691
707
desc { |tcx| "computing implementation polarity of `{}`" , tcx. def_path_str( impl_id) }
708
+ cache_on_disk_if { impl_id. is_local( ) }
692
709
separate_provide_extern
693
710
}
694
711
@@ -701,6 +718,7 @@ rustc_queries! {
701
718
/// Methods in these implementations don't need to be exported.
702
719
query inherent_impls( key: DefId ) -> & ' tcx [ DefId ] {
703
720
desc { |tcx| "collecting inherent impls for `{}`" , tcx. def_path_str( key) }
721
+ cache_on_disk_if { key. is_local( ) }
704
722
separate_provide_extern
705
723
}
706
724
@@ -745,6 +763,7 @@ rustc_queries! {
745
763
/// Computes the signature of the function.
746
764
query fn_sig( key: DefId ) -> ty:: PolyFnSig <' tcx> {
747
765
desc { |tcx| "computing function signature of `{}`" , tcx. def_path_str( key) }
766
+ cache_on_disk_if { key. is_local( ) }
748
767
separate_provide_extern
749
768
}
750
769
@@ -820,6 +839,7 @@ rustc_queries! {
820
839
/// Caches `CoerceUnsized` kinds for impls on custom types.
821
840
query coerce_unsized_info( key: DefId ) -> ty:: adjustment:: CoerceUnsizedInfo {
822
841
desc { |tcx| "computing CoerceUnsized info for `{}`" , tcx. def_path_str( key) }
842
+ cache_on_disk_if { key. is_local( ) }
823
843
separate_provide_extern
824
844
}
825
845
@@ -1050,28 +1070,33 @@ rustc_queries! {
1050
1070
1051
1071
query opt_def_kind( def_id: DefId ) -> Option <DefKind > {
1052
1072
desc { |tcx| "looking up definition kind of `{}`" , tcx. def_path_str( def_id) }
1073
+ cache_on_disk_if { def_id. is_local( ) }
1053
1074
separate_provide_extern
1054
1075
}
1055
1076
1056
1077
/// Gets the span for the definition.
1057
1078
query def_span( def_id: DefId ) -> Span {
1058
1079
desc { |tcx| "looking up span for `{}`" , tcx. def_path_str( def_id) }
1080
+ cache_on_disk_if { def_id. is_local( ) }
1059
1081
separate_provide_extern
1060
1082
}
1061
1083
1062
1084
/// Gets the span for the identifier of the definition.
1063
1085
query def_ident_span( def_id: DefId ) -> Option <Span > {
1064
1086
desc { |tcx| "looking up span for `{}`'s identifier" , tcx. def_path_str( def_id) }
1087
+ cache_on_disk_if { def_id. is_local( ) }
1065
1088
separate_provide_extern
1066
1089
}
1067
1090
1068
1091
query lookup_stability( def_id: DefId ) -> Option <attr:: Stability > {
1069
1092
desc { |tcx| "looking up stability of `{}`" , tcx. def_path_str( def_id) }
1093
+ cache_on_disk_if { def_id. is_local( ) }
1070
1094
separate_provide_extern
1071
1095
}
1072
1096
1073
1097
query lookup_const_stability( def_id: DefId ) -> Option <attr:: ConstStability > {
1074
1098
desc { |tcx| "looking up const stability of `{}`" , tcx. def_path_str( def_id) }
1099
+ cache_on_disk_if { def_id. is_local( ) }
1075
1100
separate_provide_extern
1076
1101
}
1077
1102
@@ -1081,6 +1106,7 @@ rustc_queries! {
1081
1106
1082
1107
query lookup_deprecation_entry( def_id: DefId ) -> Option <DeprecationEntry > {
1083
1108
desc { |tcx| "checking whether `{}` is deprecated" , tcx. def_path_str( def_id) }
1109
+ cache_on_disk_if { def_id. is_local( ) }
1084
1110
separate_provide_extern
1085
1111
}
1086
1112
@@ -1110,33 +1136,39 @@ rustc_queries! {
1110
1136
1111
1137
query fn_arg_names( def_id: DefId ) -> & ' tcx [ rustc_span:: symbol:: Ident ] {
1112
1138
desc { |tcx| "looking up function parameter names for `{}`" , tcx. def_path_str( def_id) }
1139
+ cache_on_disk_if { def_id. is_local( ) }
1113
1140
separate_provide_extern
1114
1141
}
1115
1142
/// Gets the rendered value of the specified constant or associated constant.
1116
1143
/// Used by rustdoc.
1117
1144
query rendered_const( def_id: DefId ) -> String {
1118
1145
storage( ArenaCacheSelector <' tcx>)
1119
1146
desc { |tcx| "rendering constant intializer of `{}`" , tcx. def_path_str( def_id) }
1147
+ cache_on_disk_if { def_id. is_local( ) }
1120
1148
separate_provide_extern
1121
1149
}
1122
1150
query impl_parent( def_id: DefId ) -> Option <DefId > {
1123
1151
desc { |tcx| "computing specialization parent impl of `{}`" , tcx. def_path_str( def_id) }
1152
+ cache_on_disk_if { def_id. is_local( ) }
1124
1153
separate_provide_extern
1125
1154
}
1126
1155
1127
1156
/// Given an `associated_item`, find the trait it belongs to.
1128
1157
/// Return `None` if the `DefId` is not an associated item.
1129
1158
query trait_of_item( associated_item: DefId ) -> Option <DefId > {
1130
1159
desc { |tcx| "finding trait defining `{}`" , tcx. def_path_str( associated_item) }
1160
+ cache_on_disk_if { associated_item. is_local( ) }
1131
1161
separate_provide_extern
1132
1162
}
1133
1163
1134
1164
query is_ctfe_mir_available( key: DefId ) -> bool {
1135
1165
desc { |tcx| "checking if item has ctfe mir available: `{}`" , tcx. def_path_str( key) }
1166
+ cache_on_disk_if { key. is_local( ) }
1136
1167
separate_provide_extern
1137
1168
}
1138
1169
query is_mir_available( key: DefId ) -> bool {
1139
1170
desc { |tcx| "checking if item has mir available: `{}`" , tcx. def_path_str( key) }
1171
+ cache_on_disk_if { key. is_local( ) }
1140
1172
separate_provide_extern
1141
1173
}
1142
1174
@@ -1378,6 +1410,7 @@ rustc_queries! {
1378
1410
1379
1411
query impl_defaultness( def_id: DefId ) -> hir:: Defaultness {
1380
1412
desc { |tcx| "looking up whether `{}` is a default impl" , tcx. def_path_str( def_id) }
1413
+ cache_on_disk_if { def_id. is_local( ) }
1381
1414
separate_provide_extern
1382
1415
}
1383
1416
@@ -1411,6 +1444,7 @@ rustc_queries! {
1411
1444
}
1412
1445
query is_reachable_non_generic( def_id: DefId ) -> bool {
1413
1446
desc { |tcx| "checking whether `{}` is an exported symbol" , tcx. def_path_str( def_id) }
1447
+ cache_on_disk_if { def_id. is_local( ) }
1414
1448
separate_provide_extern
1415
1449
}
1416
1450
query is_unreachable_local_definition( def_id: LocalDefId ) -> bool {
@@ -1730,9 +1764,9 @@ rustc_queries! {
1730
1764
/// - All names contained in `exported_symbols(cnum)` are guaranteed to
1731
1765
/// correspond to a publicly visible symbol in `cnum` machine code.
1732
1766
/// - The `exported_symbols` sets of different crates do not intersect.
1733
- query exported_symbols( _: CrateNum )
1734
- -> & ' tcx [ ( ExportedSymbol <' tcx>, SymbolExportInfo ) ] {
1767
+ query exported_symbols( cnum: CrateNum ) -> & ' tcx [ ( ExportedSymbol <' tcx>, SymbolExportInfo ) ] {
1735
1768
desc { "exported_symbols" }
1769
+ cache_on_disk_if { * cnum == LOCAL_CRATE }
1736
1770
separate_provide_extern
1737
1771
}
1738
1772
0 commit comments