Skip to content

Commit fcc5979

Browse files
authored
Rollup merge of rust-lang#91928 - fee1-dead:constification1, r=oli-obk
Constify (most) `Option` methods r? ``@oli-obk``
2 parents 64ce698 + f141bed commit fcc5979

File tree

11 files changed

+311
-77
lines changed

11 files changed

+311
-77
lines changed

compiler/rustc_middle/src/query/mod.rs

+17-4
Original file line numberDiff line numberDiff line change
@@ -771,11 +771,24 @@ rustc_queries! {
771771
desc { |tcx| "type-checking `{}`", tcx.def_path_str(key.to_def_id()) }
772772
cache_on_disk_if { true }
773773
load_cached(tcx, id) {
774-
let typeck_results: Option<ty::TypeckResults<'tcx>> = tcx
775-
.on_disk_cache().as_ref()
776-
.and_then(|c| c.try_load_query_result(*tcx, id));
774+
#[cfg(bootstrap)]
775+
{
776+
match match tcx.on_disk_cache().as_ref() {
777+
Some(c) => c.try_load_query_result(*tcx, id),
778+
None => None,
779+
} {
780+
Some(x) => Some(&*tcx.arena.alloc(x)),
781+
None => None,
782+
}
783+
}
784+
#[cfg(not(bootstrap))]
785+
{
786+
let typeck_results: Option<ty::TypeckResults<'tcx>> = tcx
787+
.on_disk_cache().as_ref()
788+
.and_then(|c| c.try_load_query_result(*tcx, id));
777789

778-
typeck_results.map(|x| &*tcx.arena.alloc(x))
790+
typeck_results.map(|x| &*tcx.arena.alloc(x))
791+
}
779792
}
780793
}
781794

library/core/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@
123123
#![feature(const_num_from_num)]
124124
#![feature(const_ops)]
125125
#![feature(const_option)]
126+
#![feature(const_option_ext)]
126127
#![feature(const_pin)]
127128
#![feature(const_replace)]
128129
#![feature(const_ptr_is_null)]

0 commit comments

Comments
 (0)