diff options
| author | Aaron Hill <aa1ronham@gmail.com> | 2020-11-19 15:49:45 -0500 |
|---|---|---|
| committer | Aaron Hill <aa1ronham@gmail.com> | 2020-11-19 15:50:55 -0500 |
| commit | d00ed018767f5ffb4d17971147fadeb860891f8d (patch) | |
| tree | 5bd12b809f73fc7df149b8fe87b1d061224f9390 /compiler/rustc_middle/src/query | |
| parent | fe982319aa0aa5bbfc2795791a753832292bd2ba (diff) | |
| download | rust-d00ed018767f5ffb4d17971147fadeb860891f8d.tar.gz rust-d00ed018767f5ffb4d17971147fadeb860891f8d.zip | |
Only create `OnDiskCache` in incremental compilation mode
This lets us skip doing useless work when we're not in incremental compilation mode.
Diffstat (limited to 'compiler/rustc_middle/src/query')
| -rw-r--r-- | compiler/rustc_middle/src/query/mod.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs index 634d50368bd..175b108dd24 100644 --- a/compiler/rustc_middle/src/query/mod.rs +++ b/compiler/rustc_middle/src/query/mod.rs @@ -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)) } |
