1
Fork 0

Only create OnDiskCache in incremental compilation mode

This lets us skip doing useless work when we're not in incremental
compilation mode.
This commit is contained in:
Aaron Hill 2020-11-19 15:49:45 -05:00
parent fe982319aa
commit d00ed01876
No known key found for this signature in database
GPG key ID: B4087E510E98B164
6 changed files with 33 additions and 17 deletions

View file

@ -130,8 +130,8 @@ rustc_queries! {
storage(ArenaCacheSelector<'tcx>)
cache_on_disk_if { key.is_local() }
load_cached(tcx, id) {
let generics: Option<ty::Generics> = tcx.queries.on_disk_cache
.try_load_query_result(tcx, id);
let generics: Option<ty::Generics> = tcx.queries.on_disk_cache.as_ref()
.and_then(|c| c.try_load_query_result(tcx, id));
generics
}
}
@ -688,8 +688,8 @@ rustc_queries! {
cache_on_disk_if { true }
load_cached(tcx, id) {
let typeck_results: Option<ty::TypeckResults<'tcx>> = tcx
.queries.on_disk_cache
.try_load_query_result(tcx, id);
.queries.on_disk_cache.as_ref()
.and_then(|c| c.try_load_query_result(tcx, id));
typeck_results.map(|x| &*tcx.arena.alloc(x))
}