about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2023-03-04 23:31:56 +0000
committerMichael Goulet <michael@errs.io>2023-03-04 23:47:50 +0000
commit118afdf071ce38f91c054f013c1774926fa28b15 (patch)
tree25fc2e00b88c030ccc809c3d8a61d3f21a627c29
parent276b75a843af8822ffe4e395266d9445679a57a4 (diff)
downloadrust-118afdf071ce38f91c054f013c1774926fa28b15.tar.gz
rust-118afdf071ce38f91c054f013c1774926fa28b15.zip
Retry pred_known_to_hold_modulo_regions with fulfillment if ambiguous
-rw-r--r--compiler/rustc_trait_selection/src/traits/mod.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/mod.rs b/compiler/rustc_trait_selection/src/traits/mod.rs
index b2317f55d25..4e30108be94 100644
--- a/compiler/rustc_trait_selection/src/traits/mod.rs
+++ b/compiler/rustc_trait_selection/src/traits/mod.rs
@@ -155,10 +155,12 @@ fn pred_known_to_hold_modulo_regions<'tcx>(
         predicate: pred.to_predicate(infcx.tcx),
     };
 
-    let result = infcx.predicate_must_hold_modulo_regions(&obligation);
+    let result = infcx.evaluate_obligation_no_overflow(&obligation);
     debug!(?result);
 
-    if result && has_non_region_infer {
+    if result.must_apply_modulo_regions() && !has_non_region_infer {
+        true
+    } else if result.may_apply() {
         // Because of inference "guessing", selection can sometimes claim
         // to succeed while the success requires a guess. To ensure
         // this function's result remains infallible, we must confirm
@@ -179,7 +181,7 @@ fn pred_known_to_hold_modulo_regions<'tcx>(
             }
         }
     } else {
-        result
+        false
     }
 }