check local cache even if global is usable
we store overflow errors locally, even if we can otherwise use the global cache for this goal.
This commit is contained in:
parent
cb2bd2bb06
commit
de94536553
1 changed files with 11 additions and 6 deletions
|
@ -1537,15 +1537,20 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
|
||||
if self.can_use_global_caches(param_env, cache_fresh_trait_pred) {
|
||||
if let Some(res) = tcx.selection_cache.get(&(infcx.typing_env(param_env), pred), tcx) {
|
||||
Some(res)
|
||||
} else {
|
||||
debug_assert_eq!(infcx.selection_cache.get(&(param_env, pred), tcx), None);
|
||||
None
|
||||
return Some(res);
|
||||
} else if cfg!(debug_assertions) {
|
||||
match infcx.selection_cache.get(&(param_env, pred), tcx) {
|
||||
None | Some(Err(Overflow(OverflowError::Canonical))) => {}
|
||||
res => bug!("unexpected local cache result: {res:?}"),
|
||||
}
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
// Subtle: we need to check the local cache even if we're able to use the
|
||||
// global cache as we don't cache overflow in the global cache but need to
|
||||
// cache it as otherwise rustdoc hangs when compiling diesel.
|
||||
infcx.selection_cache.get(&(param_env, pred), tcx)
|
||||
}
|
||||
}
|
||||
|
||||
/// Determines whether can we safely cache the result
|
||||
/// of selecting an obligation. This is almost always `true`,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue