Fix assoc-type test

This commit is contained in:
Deadbeef 2021-07-26 11:13:23 +08:00
parent 01bb3710b5
commit bcf0e2f528
No known key found for this signature in database
GPG key ID: 027DF9338862ADDD
3 changed files with 29 additions and 5 deletions

View file

@ -1,3 +1,6 @@
use rustc_hir as hir;
use rustc_middle::ty::PredicateKind;
use crate::infer::canonical::OriginalQueryValues;
use crate::infer::InferCtxt;
use crate::traits::{
@ -46,6 +49,12 @@ 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()
}