diff --git a/compiler/rustc_trait_selection/src/infer.rs b/compiler/rustc_trait_selection/src/infer.rs index ea074192d23b14262f97d2455e783b6978552bbb..c90649353e80f391b5739378a3bd29813bd5e22f 100644 --- a/compiler/rustc_trait_selection/src/infer.rs +++ b/compiler/rustc_trait_selection/src/infer.rs @@ -44,6 +44,10 @@ fn partially_normalize_associated_types_in( /// - the self type /// - the *other* type parameters of the trait, excluding the self-type /// - the parameter environment + /// + /// Invokes `evaluate_obligation`, so in the event that evaluating + /// `Ty: Trait` causes overflow, EvaluatedToRecur (or EvaluatedToUnknown) + /// will be returned. fn type_implements_trait( &self, trait_def_id: DefId, @@ -117,7 +121,7 @@ fn type_implements_trait( recursion_depth: 0, predicate: trait_ref.without_const().to_predicate(self.tcx), }; - self.evaluate_obligation_no_overflow(&obligation) + self.evaluate_obligation(&obligation).unwrap_or(traits::EvaluationResult::EvaluatedToErr) } }