Remove constness from TraitPredicate
This commit is contained in:
parent
7637653b9f
commit
4fec845c3f
90 changed files with 446 additions and 390 deletions
|
@ -25,7 +25,7 @@ pub trait TraitEngine<'tcx>: 'tcx {
|
|||
cause,
|
||||
recursion_depth: 0,
|
||||
param_env,
|
||||
predicate: ty::Binder::dummy(trait_ref).without_const().to_predicate(infcx.tcx),
|
||||
predicate: ty::Binder::dummy(trait_ref).to_predicate(infcx.tcx),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
|
|
@ -77,13 +77,6 @@ impl<'tcx> PredicateObligation<'tcx> {
|
|||
recursion_depth: self.recursion_depth,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn without_const(mut self, tcx: TyCtxt<'tcx>) -> PredicateObligation<'tcx> {
|
||||
if let ty::PredicateKind::Clause(ty::ClauseKind::Trait(trait_pred)) = self.predicate.kind().skip_binder() && trait_pred.is_const_if_const() {
|
||||
self.predicate = tcx.mk_predicate(self.predicate.kind().map_bound(|_| ty::PredicateKind::Clause(ty::ClauseKind::Trait(trait_pred.without_const()))));
|
||||
}
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> PolyTraitObligation<'tcx> {
|
||||
|
|
|
@ -264,11 +264,7 @@ impl<'tcx, O: Elaboratable<'tcx>> Elaborator<'tcx, O> {
|
|||
};
|
||||
|
||||
let obligations =
|
||||
predicates.predicates.iter().enumerate().map(|(index, &(mut clause, span))| {
|
||||
// when parent predicate is non-const, elaborate it to non-const predicates.
|
||||
if data.constness == ty::BoundConstness::NotConst {
|
||||
clause = clause.without_const(tcx);
|
||||
}
|
||||
predicates.predicates.iter().enumerate().map(|(index, &(clause, span))| {
|
||||
elaboratable.child_with_derived_cause(
|
||||
clause.subst_supertrait(tcx, &bound_predicate.rebind(data.trait_ref)),
|
||||
span,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue