make check less conservative and add explanation
This commit is contained in:
parent
54d4fc245a
commit
2931a9df2f
3 changed files with 24 additions and 11 deletions
|
@ -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
|
||||
//
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue