diff options
| author | Deadbeef <ent3rm4n@gmail.com> | 2021-12-17 14:16:12 +0800 |
|---|---|---|
| committer | Deadbeef <ent3rm4n@gmail.com> | 2021-12-17 20:46:48 +0800 |
| commit | 2f555dec4a5e3eeaea31d991c0220c4260b794e5 (patch) | |
| tree | 2e653ae2f024f8b217c9efce34f69fade7185e35 | |
| parent | 6b5f63c3fc4cc5bcaaf5cad60e2cc7e56df3487f (diff) | |
| download | rust-2f555dec4a5e3eeaea31d991c0220c4260b794e5.tar.gz rust-2f555dec4a5e3eeaea31d991c0220c4260b794e5.zip | |
Add a temporary hack before env fix lands in bootstrap
| -rw-r--r-- | compiler/rustc_middle/src/query/mod.rs | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs index 78e33544655..e2de9f12aaa 100644 --- a/compiler/rustc_middle/src/query/mod.rs +++ b/compiler/rustc_middle/src/query/mod.rs @@ -771,11 +771,24 @@ rustc_queries! { desc { |tcx| "type-checking `{}`", tcx.def_path_str(key.to_def_id()) } cache_on_disk_if { true } load_cached(tcx, id) { - let typeck_results: Option<ty::TypeckResults<'tcx>> = tcx - .on_disk_cache().as_ref() - .and_then(|c| c.try_load_query_result(*tcx, id)); + #[cfg(bootstrap)] + { + match match tcx.on_disk_cache().as_ref() { + Some(c) => c.try_load_query_result(*tcx, id), + None => None, + } { + Some(x) => Some(&*tcx.arena.alloc(x)), + None => None, + } + } + #[cfg(not(bootstrap))] + { + let typeck_results: Option<ty::TypeckResults<'tcx>> = tcx + .on_disk_cache().as_ref() + .and_then(|c| c.try_load_query_result(*tcx, id)); - typeck_results.map(|x| &*tcx.arena.alloc(x)) + typeck_results.map(|x| &*tcx.arena.alloc(x)) + } } } |
