Skip to content

Commit c418a48

Browse files
authored
Rollup merge of #88320 - sexxi-goose:issue-88103, r=nikomatsakis
type_implements_trait consider obligation failure on overflow Fixes: #88103
2 parents dfca7b3 + 88bcd44 commit c418a48

File tree

1 file changed

+5
-1
lines changed
  • compiler/rustc_trait_selection/src

1 file changed

+5
-1
lines changed

compiler/rustc_trait_selection/src/infer.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ pub trait InferCtxtExt<'tcx> {
4444
/// - the self type
4545
/// - the *other* type parameters of the trait, excluding the self-type
4646
/// - the parameter environment
47+
///
48+
/// Invokes `evaluate_obligation`, so in the event that evaluating
49+
/// `Ty: Trait` causes overflow, EvaluatedToRecur (or EvaluatedToUnknown)
50+
/// will be returned.
4751
fn type_implements_trait(
4852
&self,
4953
trait_def_id: DefId,
@@ -117,7 +121,7 @@ impl<'cx, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'cx, 'tcx> {
117121
recursion_depth: 0,
118122
predicate: trait_ref.without_const().to_predicate(self.tcx),
119123
};
120-
self.evaluate_obligation_no_overflow(&obligation)
124+
self.evaluate_obligation(&obligation).unwrap_or(traits::EvaluationResult::EvaluatedToErr)
121125
}
122126
}
123127

0 commit comments

Comments
 (0)