Remap elaborated obligation constness

This commit is contained in:
Deadbeef 2022-01-29 01:47:58 +11:00
parent 9b75f2d498
commit 08cb878430

View File

@ -145,7 +145,12 @@ fn elaborate(&mut self, obligation: &PredicateObligation<'tcx>) {
// Get predicates declared on the trait.
let predicates = tcx.super_predicates_of(data.def_id());
let obligations = predicates.predicates.iter().map(|&(pred, _)| {
let obligations = predicates.predicates.iter().map(|&(mut pred, _)| {
// when parent predicate is non-const, elaborate it to non-const predicates.
if data.constness == ty::BoundConstness::NotConst {
pred = pred.without_const(tcx);
}
predicate_obligation(
pred.subst_supertrait(tcx, &bound_predicate.rebind(data.trait_ref)),
obligation.param_env,