diff options
| author | Deadbeef <ent3rm4n@gmail.com> | 2022-01-29 01:47:58 +1100 |
|---|---|---|
| committer | Deadbeef <ent3rm4n@gmail.com> | 2022-07-23 14:25:55 +0000 |
| commit | 08cb87843010ef1dcee0e8bc91c3d95eed70c1eb (patch) | |
| tree | af3c745a8cca104048eaf7d4c4a161934e7b4a64 | |
| parent | 9b75f2d498d67f61c3b40ec57f5ce23ef8e3d874 (diff) | |
| download | rust-08cb87843010ef1dcee0e8bc91c3d95eed70c1eb.tar.gz rust-08cb87843010ef1dcee0e8bc91c3d95eed70c1eb.zip | |
Remap elaborated obligation constness
| -rw-r--r-- | compiler/rustc_infer/src/traits/util.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/rustc_infer/src/traits/util.rs b/compiler/rustc_infer/src/traits/util.rs index 674c75fdee5..38ff9343537 100644 --- a/compiler/rustc_infer/src/traits/util.rs +++ b/compiler/rustc_infer/src/traits/util.rs @@ -145,7 +145,12 @@ impl<'tcx> Elaborator<'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, |
