make check less conservative and add explanation
This commit is contained in:
@@ -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
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user