Skip to content

Commit

Permalink
Rollup merge of rust-lang#91928 - fee1-dead:constification1, r=oli-obk
Browse files Browse the repository at this point in the history
Constify (most) `Option` methods

r? `@oli-obk`
  • Loading branch information
matthiaskrgr authored Dec 17, 2021
2 parents cd8da43 + f141bed commit 7e0e540
Show file tree
Hide file tree
Showing 11 changed files with 311 additions and 77 deletions.
21 changes: 17 additions & 4 deletions compiler/rustc_middle/src/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
}
}

Expand Down
1 change: 1 addition & 0 deletions library/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
#![feature(const_num_from_num)]
#![feature(const_ops)]
#![feature(const_option)]
#![feature(const_option_ext)]
#![feature(const_pin)]
#![feature(const_replace)]
#![feature(const_ptr_is_null)]
Expand Down
Loading

0 comments on commit 7e0e540

Please sign in to comment.