Skip to content

Commit f58f2c8

Browse files
committed
don't cache overflow results globally
1 parent 7b2aeca commit f58f2c8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/librustc/traits/select.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1376,7 +1376,10 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
13761376
let tcx = self.tcx();
13771377
let trait_ref = cache_fresh_trait_pred.skip_binder().trait_ref;
13781378
if self.can_use_global_caches(param_env) {
1379-
if let Some(trait_ref) = tcx.lift_to_global(&trait_ref) {
1379+
if let Err(Overflow) = candidate {
1380+
// Don't cache overflow globally; we only produce this
1381+
// in certain modes.
1382+
} else if let Some(trait_ref) = tcx.lift_to_global(&trait_ref) {
13801383
if let Some(candidate) = tcx.lift_to_global(&candidate) {
13811384
debug!(
13821385
"insert_candidate_cache(trait_ref={:?}, candidate={:?}) global",

0 commit comments

Comments
 (0)