Remove param env from relation altogether
This commit is contained in:
parent
009cd9c815
commit
a75d0021ed
11 changed files with 22 additions and 38 deletions
|
@ -2653,10 +2653,6 @@ impl<'tcx> TypeRelation<'tcx> for SameTypeModuloInfer<'_, 'tcx> {
|
||||||
self.0.tcx
|
self.0.tcx
|
||||||
}
|
}
|
||||||
|
|
||||||
fn param_env(&self) -> ty::ParamEnv<'tcx> {
|
|
||||||
unreachable!("purely structural relation should not need a param-env")
|
|
||||||
}
|
|
||||||
|
|
||||||
fn tag(&self) -> &'static str {
|
fn tag(&self) -> &'static str {
|
||||||
"SameTypeModuloInfer"
|
"SameTypeModuloInfer"
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,10 +144,6 @@ impl<'tcx> TypeRelation<'tcx> for MatchAgainstHigherRankedOutlives<'tcx> {
|
||||||
self.tcx
|
self.tcx
|
||||||
}
|
}
|
||||||
|
|
||||||
fn param_env(&self) -> ty::ParamEnv<'tcx> {
|
|
||||||
unreachable!("purely structural relation should not need a param-env")
|
|
||||||
}
|
|
||||||
|
|
||||||
fn a_is_expected(&self) -> bool {
|
fn a_is_expected(&self) -> bool {
|
||||||
true
|
true
|
||||||
} // irrelevant
|
} // irrelevant
|
||||||
|
|
|
@ -563,6 +563,8 @@ impl<'infcx, 'tcx> CombineFields<'infcx, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait ObligationEmittingRelation<'tcx>: TypeRelation<'tcx> {
|
pub trait ObligationEmittingRelation<'tcx>: TypeRelation<'tcx> {
|
||||||
|
fn param_env(&self) -> ty::ParamEnv<'tcx>;
|
||||||
|
|
||||||
/// Register obligations that must hold in order for this relation to hold
|
/// Register obligations that must hold in order for this relation to hold
|
||||||
fn register_obligations(&mut self, obligations: PredicateObligations<'tcx>);
|
fn register_obligations(&mut self, obligations: PredicateObligations<'tcx>);
|
||||||
|
|
||||||
|
|
|
@ -33,10 +33,6 @@ impl<'tcx> TypeRelation<'tcx> for Equate<'_, '_, 'tcx> {
|
||||||
self.fields.tcx()
|
self.fields.tcx()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn param_env(&self) -> ty::ParamEnv<'tcx> {
|
|
||||||
self.fields.param_env
|
|
||||||
}
|
|
||||||
|
|
||||||
fn a_is_expected(&self) -> bool {
|
fn a_is_expected(&self) -> bool {
|
||||||
self.a_is_expected
|
self.a_is_expected
|
||||||
}
|
}
|
||||||
|
@ -174,6 +170,10 @@ impl<'tcx> TypeRelation<'tcx> for Equate<'_, '_, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> ObligationEmittingRelation<'tcx> for Equate<'_, '_, 'tcx> {
|
impl<'tcx> ObligationEmittingRelation<'tcx> for Equate<'_, '_, 'tcx> {
|
||||||
|
fn param_env(&self) -> ty::ParamEnv<'tcx> {
|
||||||
|
self.fields.param_env
|
||||||
|
}
|
||||||
|
|
||||||
fn register_predicates(&mut self, obligations: impl IntoIterator<Item: ty::ToPredicate<'tcx>>) {
|
fn register_predicates(&mut self, obligations: impl IntoIterator<Item: ty::ToPredicate<'tcx>>) {
|
||||||
self.fields.register_predicates(obligations);
|
self.fields.register_predicates(obligations);
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,10 +182,6 @@ where
|
||||||
self.infcx.tcx
|
self.infcx.tcx
|
||||||
}
|
}
|
||||||
|
|
||||||
fn param_env(&self) -> ty::ParamEnv<'tcx> {
|
|
||||||
self.delegate.param_env()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn tag(&self) -> &'static str {
|
fn tag(&self) -> &'static str {
|
||||||
"Generalizer"
|
"Generalizer"
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,10 +32,6 @@ impl<'tcx> TypeRelation<'tcx> for Glb<'_, '_, 'tcx> {
|
||||||
self.fields.tcx()
|
self.fields.tcx()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn param_env(&self) -> ty::ParamEnv<'tcx> {
|
|
||||||
self.fields.param_env
|
|
||||||
}
|
|
||||||
|
|
||||||
fn a_is_expected(&self) -> bool {
|
fn a_is_expected(&self) -> bool {
|
||||||
self.a_is_expected
|
self.a_is_expected
|
||||||
}
|
}
|
||||||
|
@ -138,6 +134,10 @@ impl<'combine, 'infcx, 'tcx> LatticeDir<'infcx, 'tcx> for Glb<'combine, 'infcx,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> ObligationEmittingRelation<'tcx> for Glb<'_, '_, 'tcx> {
|
impl<'tcx> ObligationEmittingRelation<'tcx> for Glb<'_, '_, 'tcx> {
|
||||||
|
fn param_env(&self) -> ty::ParamEnv<'tcx> {
|
||||||
|
self.fields.param_env
|
||||||
|
}
|
||||||
|
|
||||||
fn register_predicates(&mut self, obligations: impl IntoIterator<Item: ty::ToPredicate<'tcx>>) {
|
fn register_predicates(&mut self, obligations: impl IntoIterator<Item: ty::ToPredicate<'tcx>>) {
|
||||||
self.fields.register_predicates(obligations);
|
self.fields.register_predicates(obligations);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,10 +32,6 @@ impl<'tcx> TypeRelation<'tcx> for Lub<'_, '_, 'tcx> {
|
||||||
self.fields.tcx()
|
self.fields.tcx()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn param_env(&self) -> ty::ParamEnv<'tcx> {
|
|
||||||
self.fields.param_env
|
|
||||||
}
|
|
||||||
|
|
||||||
fn a_is_expected(&self) -> bool {
|
fn a_is_expected(&self) -> bool {
|
||||||
self.a_is_expected
|
self.a_is_expected
|
||||||
}
|
}
|
||||||
|
@ -138,6 +134,10 @@ impl<'combine, 'infcx, 'tcx> LatticeDir<'infcx, 'tcx> for Lub<'combine, 'infcx,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> ObligationEmittingRelation<'tcx> for Lub<'_, '_, 'tcx> {
|
impl<'tcx> ObligationEmittingRelation<'tcx> for Lub<'_, '_, 'tcx> {
|
||||||
|
fn param_env(&self) -> ty::ParamEnv<'tcx> {
|
||||||
|
self.fields.param_env
|
||||||
|
}
|
||||||
|
|
||||||
fn register_predicates(&mut self, obligations: impl IntoIterator<Item: ty::ToPredicate<'tcx>>) {
|
fn register_predicates(&mut self, obligations: impl IntoIterator<Item: ty::ToPredicate<'tcx>>) {
|
||||||
self.fields.register_predicates(obligations);
|
self.fields.register_predicates(obligations);
|
||||||
}
|
}
|
||||||
|
|
|
@ -431,10 +431,6 @@ where
|
||||||
self.infcx.tcx
|
self.infcx.tcx
|
||||||
}
|
}
|
||||||
|
|
||||||
fn param_env(&self) -> ty::ParamEnv<'tcx> {
|
|
||||||
self.delegate.param_env()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn tag(&self) -> &'static str {
|
fn tag(&self) -> &'static str {
|
||||||
"nll::subtype"
|
"nll::subtype"
|
||||||
}
|
}
|
||||||
|
@ -670,6 +666,10 @@ impl<'tcx, D> ObligationEmittingRelation<'tcx> for TypeRelating<'_, 'tcx, D>
|
||||||
where
|
where
|
||||||
D: TypeRelatingDelegate<'tcx>,
|
D: TypeRelatingDelegate<'tcx>,
|
||||||
{
|
{
|
||||||
|
fn param_env(&self) -> ty::ParamEnv<'tcx> {
|
||||||
|
self.delegate.param_env()
|
||||||
|
}
|
||||||
|
|
||||||
fn register_predicates(&mut self, obligations: impl IntoIterator<Item: ty::ToPredicate<'tcx>>) {
|
fn register_predicates(&mut self, obligations: impl IntoIterator<Item: ty::ToPredicate<'tcx>>) {
|
||||||
self.delegate.register_obligations(
|
self.delegate.register_obligations(
|
||||||
obligations
|
obligations
|
||||||
|
|
|
@ -39,10 +39,6 @@ impl<'tcx> TypeRelation<'tcx> for Sub<'_, '_, 'tcx> {
|
||||||
self.fields.infcx.tcx
|
self.fields.infcx.tcx
|
||||||
}
|
}
|
||||||
|
|
||||||
fn param_env(&self) -> ty::ParamEnv<'tcx> {
|
|
||||||
self.fields.param_env
|
|
||||||
}
|
|
||||||
|
|
||||||
fn a_is_expected(&self) -> bool {
|
fn a_is_expected(&self) -> bool {
|
||||||
self.a_is_expected
|
self.a_is_expected
|
||||||
}
|
}
|
||||||
|
@ -203,6 +199,10 @@ impl<'tcx> TypeRelation<'tcx> for Sub<'_, '_, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> ObligationEmittingRelation<'tcx> for Sub<'_, '_, 'tcx> {
|
impl<'tcx> ObligationEmittingRelation<'tcx> for Sub<'_, '_, 'tcx> {
|
||||||
|
fn param_env(&self) -> ty::ParamEnv<'tcx> {
|
||||||
|
self.fields.param_env
|
||||||
|
}
|
||||||
|
|
||||||
fn register_predicates(&mut self, obligations: impl IntoIterator<Item: ty::ToPredicate<'tcx>>) {
|
fn register_predicates(&mut self, obligations: impl IntoIterator<Item: ty::ToPredicate<'tcx>>) {
|
||||||
self.fields.register_predicates(obligations);
|
self.fields.register_predicates(obligations);
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,10 +37,6 @@ impl<'tcx> TypeRelation<'tcx> for MatchAgainstFreshVars<'tcx> {
|
||||||
self.tcx
|
self.tcx
|
||||||
}
|
}
|
||||||
|
|
||||||
fn param_env(&self) -> ty::ParamEnv<'tcx> {
|
|
||||||
panic!("relation should not need a param-env")
|
|
||||||
}
|
|
||||||
|
|
||||||
fn a_is_expected(&self) -> bool {
|
fn a_is_expected(&self) -> bool {
|
||||||
true
|
true
|
||||||
} // irrelevant
|
} // irrelevant
|
||||||
|
|
|
@ -23,8 +23,6 @@ pub enum Cause {
|
||||||
pub trait TypeRelation<'tcx>: Sized {
|
pub trait TypeRelation<'tcx>: Sized {
|
||||||
fn tcx(&self) -> TyCtxt<'tcx>;
|
fn tcx(&self) -> TyCtxt<'tcx>;
|
||||||
|
|
||||||
fn param_env(&self) -> ty::ParamEnv<'tcx>;
|
|
||||||
|
|
||||||
/// Returns a static string we can use for printouts.
|
/// Returns a static string we can use for printouts.
|
||||||
fn tag(&self) -> &'static str;
|
fn tag(&self) -> &'static str;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue