1
Fork 0

make check less conservative and add explanation

This commit is contained in:
Deadbeef 2021-07-27 09:51:57 +08:00
parent 54d4fc245a
commit 2931a9df2f
No known key found for this signature in database
GPG key ID: 027DF9338862ADDD
3 changed files with 24 additions and 11 deletions

View file

@ -316,6 +316,18 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
self.infcx.tcx
}
/// returns `true` if the predicate is considered `const` to
/// this selection context.
pub fn is_predicate_const(&self, pred: ty::Predicate<'_>) -> bool {
match pred.kind().skip_binder() {
ty::PredicateKind::Trait(ty::TraitPredicate {
constness: hir::Constness::Const,
..
}) if self.const_impls_required => true,
_ => false,
}
}
///////////////////////////////////////////////////////////////////////////
// Selection
//