Skip to content

Commit

Permalink
Rollup merge of rust-lang#88320 - sexxi-goose:issue-88103, r=nikomats…
Browse files Browse the repository at this point in the history
…akis

type_implements_trait consider obligation failure on overflow

Fixes: rust-lang#88103
  • Loading branch information
Dylan-DPC committed Aug 26, 2021
2 parents 82348d4 + 88bcd44 commit 79708bc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion compiler/rustc_trait_selection/src/infer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ pub trait InferCtxtExt<'tcx> {
/// - 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,
Expand Down Expand Up @@ -117,7 +121,7 @@ impl<'cx, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'cx, 'tcx> {
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)
}
}

Expand Down

0 comments on commit 79708bc

Please sign in to comment.