@@ -59,6 +59,7 @@ rustc_queries! {
5959 query hir_module_items( key: LocalDefId ) -> rustc_middle:: hir:: ModuleItems {
6060 storage( ArenaCacheSelector <' tcx>)
6161 desc { |tcx| "HIR module items in `{}`" , tcx. def_path_str( key. to_def_id( ) ) }
62+ cache_on_disk_if { true }
6263 }
6364
6465 /// Gives access to the HIR node for the HIR owner `key`.
@@ -128,6 +129,7 @@ rustc_queries! {
128129 /// parameter. e.g. `fn example<const N: usize=3>` called on `N` would return `3`.
129130 query const_param_default( param: DefId ) -> ty:: Const <' tcx> {
130131 desc { |tcx| "compute const default for a given parameter `{}`" , tcx. def_path_str( param) }
132+ cache_on_disk_if { param. is_local( ) }
131133 separate_provide_extern
132134 }
133135
@@ -223,6 +225,7 @@ rustc_queries! {
223225 /// Bounds from the parent (e.g. with nested impl trait) are not included.
224226 query explicit_item_bounds( key: DefId ) -> & ' tcx [ ( ty:: Predicate <' tcx>, Span ) ] {
225227 desc { |tcx| "finding item bounds for `{}`" , tcx. def_path_str( key) }
228+ cache_on_disk_if { key. is_local( ) }
226229 separate_provide_extern
227230 }
228231
@@ -508,13 +511,15 @@ rustc_queries! {
508511 /// Returns the predicates written explicitly by the user.
509512 query explicit_predicates_of( key: DefId ) -> ty:: GenericPredicates <' tcx> {
510513 desc { |tcx| "computing explicit predicates of `{}`" , tcx. def_path_str( key) }
514+ cache_on_disk_if { key. is_local( ) }
511515 separate_provide_extern
512516 }
513517
514518 /// Returns the inferred outlives predicates (e.g., for `struct
515519 /// Foo<'a, T> { x: &'a T }`, this would return `T: 'a`).
516520 query inferred_outlives_of( key: DefId ) -> & ' tcx [ ( ty:: Predicate <' tcx>, Span ) ] {
517521 desc { |tcx| "computing inferred outlives predicates of `{}`" , tcx. def_path_str( key) }
522+ cache_on_disk_if { key. is_local( ) }
518523 separate_provide_extern
519524 }
520525
@@ -526,6 +531,7 @@ rustc_queries! {
526531 /// additional acyclicity requirements).
527532 query super_predicates_of( key: DefId ) -> ty:: GenericPredicates <' tcx> {
528533 desc { |tcx| "computing the super predicates of `{}`" , tcx. def_path_str( key) }
534+ cache_on_disk_if { key. is_local( ) }
529535 separate_provide_extern
530536 }
531537
@@ -549,6 +555,7 @@ rustc_queries! {
549555 query trait_def( key: DefId ) -> ty:: TraitDef {
550556 desc { |tcx| "computing trait definition for `{}`" , tcx. def_path_str( key) }
551557 storage( ArenaCacheSelector <' tcx>)
558+ cache_on_disk_if { key. is_local( ) }
552559 separate_provide_extern
553560 }
554561 query adt_def( key: DefId ) -> ty:: AdtDef <' tcx> {
@@ -558,6 +565,7 @@ rustc_queries! {
558565 }
559566 query adt_destructor( key: DefId ) -> Option <ty:: Destructor > {
560567 desc { |tcx| "computing `Drop` impl for `{}`" , tcx. def_path_str( key) }
568+ cache_on_disk_if { key. is_local( ) }
561569 separate_provide_extern
562570 }
563571
@@ -587,11 +595,13 @@ rustc_queries! {
587595 /// `is_const_fn` function.
588596 query impl_constness( key: DefId ) -> hir:: Constness {
589597 desc { |tcx| "checking if item is const fn: `{}`" , tcx. def_path_str( key) }
598+ cache_on_disk_if { key. is_local( ) }
590599 separate_provide_extern
591600 }
592601
593602 query asyncness( key: DefId ) -> hir:: IsAsync {
594603 desc { |tcx| "checking if the function is async: `{}`" , tcx. def_path_str( key) }
604+ cache_on_disk_if { key. is_local( ) }
595605 separate_provide_extern
596606 }
597607
@@ -609,12 +619,14 @@ rustc_queries! {
609619 /// Returns `true` if this is a foreign item (i.e., linked via `extern { ... }`).
610620 query is_foreign_item( key: DefId ) -> bool {
611621 desc { |tcx| "checking if `{}` is a foreign item" , tcx. def_path_str( key) }
622+ cache_on_disk_if { key. is_local( ) }
612623 separate_provide_extern
613624 }
614625
615626 /// Returns `Some(generator_kind)` if the node pointed to by `def_id` is a generator.
616627 query generator_kind( def_id: DefId ) -> Option <hir:: GeneratorKind > {
617628 desc { |tcx| "looking up generator kind of `{}`" , tcx. def_path_str( def_id) }
629+ cache_on_disk_if { def_id. is_local( ) }
618630 separate_provide_extern
619631 }
620632
@@ -627,6 +639,7 @@ rustc_queries! {
627639 /// Maps from the `DefId` of a type or region parameter to its (inferred) variance.
628640 query variances_of( def_id: DefId ) -> & ' tcx [ ty:: Variance ] {
629641 desc { |tcx| "computing the variances of `{}`" , tcx. def_path_str( def_id) }
642+ cache_on_disk_if { def_id. is_local( ) }
630643 separate_provide_extern
631644 }
632645
@@ -639,13 +652,15 @@ rustc_queries! {
639652 /// Maps from an impl/trait `DefId` to a list of the `DefId`s of its items.
640653 query associated_item_def_ids( key: DefId ) -> & ' tcx [ DefId ] {
641654 desc { |tcx| "collecting associated items of `{}`" , tcx. def_path_str( key) }
655+ cache_on_disk_if { key. is_local( ) }
642656 separate_provide_extern
643657 }
644658
645659 /// Maps from a trait item to the trait item "descriptor".
646660 query associated_item( key: DefId ) -> ty:: AssocItem {
647661 desc { |tcx| "computing associated item data for `{}`" , tcx. def_path_str( key) }
648662 storage( ArenaCacheSelector <' tcx>)
663+ cache_on_disk_if { key. is_local( ) }
649664 separate_provide_extern
650665 }
651666
@@ -685,10 +700,12 @@ rustc_queries! {
685700 /// Return `None` if this is an inherent impl.
686701 query impl_trait_ref( impl_id: DefId ) -> Option <ty:: TraitRef <' tcx>> {
687702 desc { |tcx| "computing trait implemented by `{}`" , tcx. def_path_str( impl_id) }
703+ cache_on_disk_if { impl_id. is_local( ) }
688704 separate_provide_extern
689705 }
690706 query impl_polarity( impl_id: DefId ) -> ty:: ImplPolarity {
691707 desc { |tcx| "computing implementation polarity of `{}`" , tcx. def_path_str( impl_id) }
708+ cache_on_disk_if { impl_id. is_local( ) }
692709 separate_provide_extern
693710 }
694711
@@ -701,6 +718,7 @@ rustc_queries! {
701718 /// Methods in these implementations don't need to be exported.
702719 query inherent_impls( key: DefId ) -> & ' tcx [ DefId ] {
703720 desc { |tcx| "collecting inherent impls for `{}`" , tcx. def_path_str( key) }
721+ cache_on_disk_if { key. is_local( ) }
704722 separate_provide_extern
705723 }
706724
@@ -745,6 +763,7 @@ rustc_queries! {
745763 /// Computes the signature of the function.
746764 query fn_sig( key: DefId ) -> ty:: PolyFnSig <' tcx> {
747765 desc { |tcx| "computing function signature of `{}`" , tcx. def_path_str( key) }
766+ cache_on_disk_if { key. is_local( ) }
748767 separate_provide_extern
749768 }
750769
@@ -820,6 +839,7 @@ rustc_queries! {
820839 /// Caches `CoerceUnsized` kinds for impls on custom types.
821840 query coerce_unsized_info( key: DefId ) -> ty:: adjustment:: CoerceUnsizedInfo {
822841 desc { |tcx| "computing CoerceUnsized info for `{}`" , tcx. def_path_str( key) }
842+ cache_on_disk_if { key. is_local( ) }
823843 separate_provide_extern
824844 }
825845
@@ -1050,28 +1070,33 @@ rustc_queries! {
10501070
10511071 query opt_def_kind( def_id: DefId ) -> Option <DefKind > {
10521072 desc { |tcx| "looking up definition kind of `{}`" , tcx. def_path_str( def_id) }
1073+ cache_on_disk_if { def_id. is_local( ) }
10531074 separate_provide_extern
10541075 }
10551076
10561077 /// Gets the span for the definition.
10571078 query def_span( def_id: DefId ) -> Span {
10581079 desc { |tcx| "looking up span for `{}`" , tcx. def_path_str( def_id) }
1080+ cache_on_disk_if { def_id. is_local( ) }
10591081 separate_provide_extern
10601082 }
10611083
10621084 /// Gets the span for the identifier of the definition.
10631085 query def_ident_span( def_id: DefId ) -> Option <Span > {
10641086 desc { |tcx| "looking up span for `{}`'s identifier" , tcx. def_path_str( def_id) }
1087+ cache_on_disk_if { def_id. is_local( ) }
10651088 separate_provide_extern
10661089 }
10671090
10681091 query lookup_stability( def_id: DefId ) -> Option <attr:: Stability > {
10691092 desc { |tcx| "looking up stability of `{}`" , tcx. def_path_str( def_id) }
1093+ cache_on_disk_if { def_id. is_local( ) }
10701094 separate_provide_extern
10711095 }
10721096
10731097 query lookup_const_stability( def_id: DefId ) -> Option <attr:: ConstStability > {
10741098 desc { |tcx| "looking up const stability of `{}`" , tcx. def_path_str( def_id) }
1099+ cache_on_disk_if { def_id. is_local( ) }
10751100 separate_provide_extern
10761101 }
10771102
@@ -1081,6 +1106,7 @@ rustc_queries! {
10811106
10821107 query lookup_deprecation_entry( def_id: DefId ) -> Option <DeprecationEntry > {
10831108 desc { |tcx| "checking whether `{}` is deprecated" , tcx. def_path_str( def_id) }
1109+ cache_on_disk_if { def_id. is_local( ) }
10841110 separate_provide_extern
10851111 }
10861112
@@ -1110,33 +1136,39 @@ rustc_queries! {
11101136
11111137 query fn_arg_names( def_id: DefId ) -> & ' tcx [ rustc_span:: symbol:: Ident ] {
11121138 desc { |tcx| "looking up function parameter names for `{}`" , tcx. def_path_str( def_id) }
1139+ cache_on_disk_if { def_id. is_local( ) }
11131140 separate_provide_extern
11141141 }
11151142 /// Gets the rendered value of the specified constant or associated constant.
11161143 /// Used by rustdoc.
11171144 query rendered_const( def_id: DefId ) -> String {
11181145 storage( ArenaCacheSelector <' tcx>)
11191146 desc { |tcx| "rendering constant intializer of `{}`" , tcx. def_path_str( def_id) }
1147+ cache_on_disk_if { def_id. is_local( ) }
11201148 separate_provide_extern
11211149 }
11221150 query impl_parent( def_id: DefId ) -> Option <DefId > {
11231151 desc { |tcx| "computing specialization parent impl of `{}`" , tcx. def_path_str( def_id) }
1152+ cache_on_disk_if { def_id. is_local( ) }
11241153 separate_provide_extern
11251154 }
11261155
11271156 /// Given an `associated_item`, find the trait it belongs to.
11281157 /// Return `None` if the `DefId` is not an associated item.
11291158 query trait_of_item( associated_item: DefId ) -> Option <DefId > {
11301159 desc { |tcx| "finding trait defining `{}`" , tcx. def_path_str( associated_item) }
1160+ cache_on_disk_if { associated_item. is_local( ) }
11311161 separate_provide_extern
11321162 }
11331163
11341164 query is_ctfe_mir_available( key: DefId ) -> bool {
11351165 desc { |tcx| "checking if item has ctfe mir available: `{}`" , tcx. def_path_str( key) }
1166+ cache_on_disk_if { key. is_local( ) }
11361167 separate_provide_extern
11371168 }
11381169 query is_mir_available( key: DefId ) -> bool {
11391170 desc { |tcx| "checking if item has mir available: `{}`" , tcx. def_path_str( key) }
1171+ cache_on_disk_if { key. is_local( ) }
11401172 separate_provide_extern
11411173 }
11421174
@@ -1378,6 +1410,7 @@ rustc_queries! {
13781410
13791411 query impl_defaultness( def_id: DefId ) -> hir:: Defaultness {
13801412 desc { |tcx| "looking up whether `{}` is a default impl" , tcx. def_path_str( def_id) }
1413+ cache_on_disk_if { def_id. is_local( ) }
13811414 separate_provide_extern
13821415 }
13831416
@@ -1411,6 +1444,7 @@ rustc_queries! {
14111444 }
14121445 query is_reachable_non_generic( def_id: DefId ) -> bool {
14131446 desc { |tcx| "checking whether `{}` is an exported symbol" , tcx. def_path_str( def_id) }
1447+ cache_on_disk_if { def_id. is_local( ) }
14141448 separate_provide_extern
14151449 }
14161450 query is_unreachable_local_definition( def_id: LocalDefId ) -> bool {
@@ -1730,9 +1764,9 @@ rustc_queries! {
17301764 /// - All names contained in `exported_symbols(cnum)` are guaranteed to
17311765 /// correspond to a publicly visible symbol in `cnum` machine code.
17321766 /// - 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 ) ] {
17351768 desc { "exported_symbols" }
1769+ cache_on_disk_if { * cnum == LOCAL_CRATE }
17361770 separate_provide_extern
17371771 }
17381772
0 commit comments