1
Fork 0

Make P parameter explicit

This commit is contained in:
Michael Goulet 2024-05-15 10:08:35 -04:00
parent 11ec3eca74
commit 412dc28d6a
14 changed files with 62 additions and 49 deletions

View file

@ -337,7 +337,10 @@ impl<'infcx, 'tcx> CombineFields<'infcx, 'tcx> {
self.obligations.extend(obligations);
}
pub fn register_predicates(&mut self, obligations: impl IntoIterator<Item: Upcast<'tcx>>) {
pub fn register_predicates(
&mut self,
obligations: impl IntoIterator<Item: Upcast<'tcx, ty::Predicate<'tcx>>>,
) {
self.obligations.extend(obligations.into_iter().map(|to_pred| {
Obligation::new(self.infcx.tcx, self.trace.cause.clone(), self.param_env, to_pred)
}))
@ -360,7 +363,10 @@ pub trait ObligationEmittingRelation<'tcx>: TypeRelation<'tcx> {
/// Register predicates that must hold in order for this relation to hold. Uses
/// a default obligation cause, [`ObligationEmittingRelation::register_obligations`] should
/// be used if control over the obligation causes is required.
fn register_predicates(&mut self, obligations: impl IntoIterator<Item: Upcast<'tcx>>);
fn register_predicates(
&mut self,
obligations: impl IntoIterator<Item: Upcast<'tcx, ty::Predicate<'tcx>>>,
);
/// Register `AliasRelate` obligation(s) that both types must be related to each other.
fn register_type_relate_obligation(&mut self, a: Ty<'tcx>, b: Ty<'tcx>);

View file

@ -140,7 +140,10 @@ impl<'tcx> ObligationEmittingRelation<'tcx> for Glb<'_, '_, 'tcx> {
self.fields.param_env
}
fn register_predicates(&mut self, obligations: impl IntoIterator<Item: ty::Upcast<'tcx>>) {
fn register_predicates(
&mut self,
obligations: impl IntoIterator<Item: ty::Upcast<'tcx, ty::Predicate<'tcx>>>,
) {
self.fields.register_predicates(obligations);
}

View file

@ -140,7 +140,10 @@ impl<'tcx> ObligationEmittingRelation<'tcx> for Lub<'_, '_, 'tcx> {
self.fields.param_env
}
fn register_predicates(&mut self, obligations: impl IntoIterator<Item: ty::Upcast<'tcx>>) {
fn register_predicates(
&mut self,
obligations: impl IntoIterator<Item: ty::Upcast<'tcx, ty::Predicate<'tcx>>>,
) {
self.fields.register_predicates(obligations);
}

View file

@ -312,7 +312,10 @@ impl<'tcx> ObligationEmittingRelation<'tcx> for TypeRelating<'_, '_, 'tcx> {
self.structurally_relate_aliases
}
fn register_predicates(&mut self, obligations: impl IntoIterator<Item: ty::Upcast<'tcx>>) {
fn register_predicates(
&mut self,
obligations: impl IntoIterator<Item: ty::Upcast<'tcx, ty::Predicate<'tcx>>>,
) {
self.fields.register_predicates(obligations);
}

View file

@ -357,9 +357,7 @@ impl<'tcx, O: Elaboratable<'tcx>> Elaborator<'tcx, O> {
None
}
})
.map(|clause| {
elaboratable.child(bound_clause.rebind(clause).upcast(tcx))
}),
.map(|clause| elaboratable.child(bound_clause.rebind(clause).upcast(tcx))),
);
}
ty::ClauseKind::RegionOutlives(..) => {