未验证 提交 c418a487 编写于 作者: M Manish Goregaokar 提交者: GitHub

Rollup merge of #88320 - sexxi-goose:issue-88103, r=nikomatsakis

type_implements_trait consider obligation failure on overflow

Fixes: #88103
...@@ -44,6 +44,10 @@ fn partially_normalize_associated_types_in<T>( ...@@ -44,6 +44,10 @@ fn partially_normalize_associated_types_in<T>(
/// - the self type /// - the self type
/// - the *other* type parameters of the trait, excluding the self-type /// - the *other* type parameters of the trait, excluding the self-type
/// - the parameter environment /// - 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( fn type_implements_trait(
&self, &self,
trait_def_id: DefId, trait_def_id: DefId,
...@@ -117,7 +121,7 @@ fn type_implements_trait( ...@@ -117,7 +121,7 @@ fn type_implements_trait(
recursion_depth: 0, recursion_depth: 0,
predicate: trait_ref.without_const().to_predicate(self.tcx), predicate: trait_ref.without_const().to_predicate(self.tcx),
}; };
self.evaluate_obligation_no_overflow(&obligation) self.evaluate_obligation(&obligation).unwrap_or(traits::EvaluationResult::EvaluatedToErr)
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册