diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2021-08-26 12:38:11 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-08-26 12:38:11 -0700 |
| commit | c418a48737a3d7b18c090ed1ae605f5e0561c1b3 (patch) | |
| tree | 78999cf62ce5db7a43a13ca548a13310bd2117b8 | |
| parent | dfca7b333182c9f2153e846525833d7ed1c3bfd4 (diff) | |
| parent | 88bcd4457be4d37d83d505ad3fe2dc7a5ce7203a (diff) | |
| download | rust-c418a48737a3d7b18c090ed1ae605f5e0561c1b3.tar.gz rust-c418a48737a3d7b18c090ed1ae605f5e0561c1b3.zip | |
Rollup merge of #88320 - sexxi-goose:issue-88103, r=nikomatsakis
type_implements_trait consider obligation failure on overflow Fixes: #88103
| -rw-r--r-- | compiler/rustc_trait_selection/src/infer.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/rustc_trait_selection/src/infer.rs b/compiler/rustc_trait_selection/src/infer.rs index ea074192d23..c90649353e8 100644 --- a/compiler/rustc_trait_selection/src/infer.rs +++ b/compiler/rustc_trait_selection/src/infer.rs @@ -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, @@ -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) } } |
