We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9b75f2d commit 08cb878Copy full SHA for 08cb878
compiler/rustc_infer/src/traits/util.rs
@@ -145,7 +145,12 @@ impl<'tcx> Elaborator<'tcx> {
145
// Get predicates declared on the trait.
146
let predicates = tcx.super_predicates_of(data.def_id());
147
148
- let obligations = predicates.predicates.iter().map(|&(pred, _)| {
+ 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
+
154
predicate_obligation(
155
pred.subst_supertrait(tcx, &bound_predicate.rebind(data.trait_ref)),
156
obligation.param_env,
0 commit comments