Skip to content

Commit 08cb878

Browse files
committed
Remap elaborated obligation constness
1 parent 9b75f2d commit 08cb878

File tree

1 file changed

+6
-1
lines changed
  • compiler/rustc_infer/src/traits

1 file changed

+6
-1
lines changed

compiler/rustc_infer/src/traits/util.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,12 @@ impl<'tcx> Elaborator<'tcx> {
145145
// Get predicates declared on the trait.
146146
let predicates = tcx.super_predicates_of(data.def_id());
147147

148-
let obligations = predicates.predicates.iter().map(|&(pred, _)| {
148+
let obligations = predicates.predicates.iter().map(|&(mut pred, _)| {
149+
// when parent predicate is non-const, elaborate it to non-const predicates.
150+
if data.constness == ty::BoundConstness::NotConst {
151+
pred = pred.without_const(tcx);
152+
}
153+
149154
predicate_obligation(
150155
pred.subst_supertrait(tcx, &bound_predicate.rebind(data.trait_ref)),
151156
obligation.param_env,

0 commit comments

Comments
 (0)