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
3 changed files with 24 additions and 11 deletions

View File

@@ -1,6 +1,3 @@
use rustc_hir as hir;
use rustc_middle::ty::PredicateKind;
use crate::infer::canonical::OriginalQueryValues;
use crate::infer::InferCtxt;
use crate::traits::{
@@ -49,12 +46,6 @@ impl<'cx, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'cx, 'tcx> {
&self,
obligation: &PredicateObligation<'tcx>,
) -> bool {
if let PredicateKind::Trait(pred) = obligation.predicate.kind().skip_binder() {
if let hir::Constness::Const = pred.constness {
// do not evaluate to holds when we have a const predicate.
return false;
}
}
self.evaluate_obligation_no_overflow(obligation).must_apply_considering_regions()
}