From cbe932801892da06688b53638622be1c8a1c8974 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Fri, 11 Nov 2022 03:19:02 +0000 Subject: Do not need to account for overflow in predicate_can_apply --- compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'compiler/rustc_trait_selection/src') diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs index 946e6e77a3d..c2a7be80467 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs @@ -2544,7 +2544,10 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> { let obligation = Obligation::new(self.tcx, ObligationCause::dummy(), param_env, cleaned_pred); - self.predicate_may_hold(&obligation) + // We don't use `InferCtxt::predicate_may_hold` because that + // will re-run predicates that overflow locally, which ends up + // taking a really long time to compute. + self.evaluate_obligation(&obligation).map_or(false, |eval| eval.may_apply()) }) } -- cgit 1.4.1-3-g733a5 From a884a9e634b827781e77bddf4082f1196301d86f Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Fri, 11 Nov 2022 03:37:04 +0000 Subject: Drive-by: Don't manually call evaluate_obligation_no_overflow --- .../rustc_trait_selection/src/traits/error_reporting/suggestions.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'compiler/rustc_trait_selection/src') diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs index 186109e7075..bb6d7d0e8df 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs @@ -1340,9 +1340,8 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { obligation.param_env, trait_pred_and_suggested_ty, ); - let suggested_ty_would_satisfy_obligation = self - .evaluate_obligation_no_overflow(&new_obligation) - .must_apply_modulo_regions(); + let suggested_ty_would_satisfy_obligation = + self.predicate_must_hold_modulo_regions(&new_obligation); if suggested_ty_would_satisfy_obligation { let sp = self .tcx -- cgit 1.4.1-3-g733a5