1
Fork 0

Rollup merge of #91928 - fee1-dead:constification1, r=oli-obk

Constify (most) `Option` methods

r? ``@oli-obk``
This commit is contained in:
Matthias Krüger 2021-12-18 08:16:29 +01:00 committed by GitHub
commit fcc59794a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 311 additions and 77 deletions

View file

@ -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))
}
}
}