Skip to content

Commit

Permalink
Increase instances of try_get_cached
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoxc committed Apr 7, 2023
1 parent f5b8f44 commit 327563f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions compiler/rustc_middle/src/ty/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ macro_rules! define_callbacks {
let key = key.into_query_param();
opt_remap_env_constness!([$($modifiers)*][key]);

match try_get_cached(self.tcx, &self.tcx.query_system.caches.$name, &key) {
match try_get_cached::<_, _, $V>(self.tcx, &self.tcx.query_system.caches.$name, &key) {
Some(_) => return,
None => self.tcx.queries.$name(
self.tcx,
Expand All @@ -374,7 +374,7 @@ macro_rules! define_callbacks {
let key = key.into_query_param();
opt_remap_env_constness!([$($modifiers)*][key]);

match try_get_cached(self.tcx, &self.tcx.query_system.caches.$name, &key) {
match try_get_cached::<_, _, $V>(self.tcx, &self.tcx.query_system.caches.$name, &key) {
Some(_) => return,
None => self.tcx.queries.$name(
self.tcx,
Expand Down Expand Up @@ -404,7 +404,7 @@ macro_rules! define_callbacks {
let key = key.into_query_param();
opt_remap_env_constness!([$($modifiers)*][key]);

restore::<$V>(match try_get_cached(self.tcx, &self.tcx.query_system.caches.$name, &key) {
restore::<$V>(match try_get_cached::<_, _, $V>(self.tcx, &self.tcx.query_system.caches.$name, &key) {
Some(value) => value,
None => self.tcx.queries.$name(self.tcx, self.span, key, QueryMode::Get).unwrap(),
})
Expand Down Expand Up @@ -499,7 +499,7 @@ macro_rules! define_feedable {
let value = restore::<$V>(erased);
let cache = &tcx.query_system.caches.$name;

match try_get_cached(tcx, cache, &key) {
match try_get_cached::<_, _, $V>(tcx, cache, &key) {
Some(old) => {
let old = restore::<$V>(old);
bug!(
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_query_system/src/query/plumbing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ pub(crate) struct CycleError<D: DepKind> {
/// which will be used if the query is not in the cache and we need
/// to compute it.
#[inline]
pub fn try_get_cached<Tcx, C>(tcx: Tcx, cache: &C, key: &C::Key) -> Option<C::Value>
pub fn try_get_cached<Tcx, C, V>(tcx: Tcx, cache: &C, key: &C::Key) -> Option<C::Value>
where
C: QueryCache,
Tcx: DepContext,
Expand Down

0 comments on commit 327563f

Please sign in to comment.