Skip to content

Commit b9f0445

Browse files
authored
Rollup merge of #101787 - compiler-errors:cache-rpitit, r=petrochenkov
cache `collect_trait_impl_trait_tys` Micro-optimization for RPITITs
2 parents ed156fb + 4cdf264 commit b9f0445

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

compiler/rustc_middle/src/arena.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ macro_rules! arena_types {
102102

103103
[] dep_kind: rustc_middle::dep_graph::DepKindStruct<'tcx>,
104104

105-
[] trait_impl_trait_tys: rustc_data_structures::fx::FxHashMap<rustc_hir::def_id::DefId, rustc_middle::ty::Ty<'tcx>>,
105+
[decode] trait_impl_trait_tys: rustc_data_structures::fx::FxHashMap<rustc_hir::def_id::DefId, rustc_middle::ty::Ty<'tcx>>,
106106
]);
107107
)
108108
}

compiler/rustc_middle/src/query/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@ rustc_queries! {
164164
query collect_trait_impl_trait_tys(key: DefId)
165165
-> Result<&'tcx FxHashMap<DefId, Ty<'tcx>>, ErrorGuaranteed>
166166
{
167-
desc { "better description please" }
167+
desc { "compare an impl and trait method signature, inferring any hidden `impl Trait` types in the process" }
168+
cache_on_disk_if { key.is_local() }
168169
separate_provide_extern
169170
}
170171

compiler/rustc_query_impl/src/on_disk_cache.rs

+6
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,12 @@ impl<'a, 'tcx> Decodable<CacheDecoder<'a, 'tcx>> for &'tcx FxHashSet<LocalDefId>
798798
}
799799
}
800800

801+
impl<'a, 'tcx> Decodable<CacheDecoder<'a, 'tcx>> for &'tcx FxHashMap<DefId, Ty<'tcx>> {
802+
fn decode(d: &mut CacheDecoder<'a, 'tcx>) -> Self {
803+
RefDecodable::decode(d)
804+
}
805+
}
806+
801807
impl<'a, 'tcx> Decodable<CacheDecoder<'a, 'tcx>>
802808
for &'tcx IndexVec<mir::Promoted, mir::Body<'tcx>>
803809
{

0 commit comments

Comments
 (0)