1
Fork 0

Rename AliasEq -> AliasRelate

This commit is contained in:
Michael Goulet 2023-03-21 22:11:40 +00:00
parent 5dc3fd7c05
commit 3a36a093dd
29 changed files with 57 additions and 53 deletions

View file

@ -223,9 +223,11 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
ty::PredicateKind::TypeWellFormedFromEnv(..) => {
bug!("TypeWellFormedFromEnv is only used for Chalk")
}
ty::PredicateKind::AliasEq(lhs, rhs, direction) => {
self.compute_alias_eq_goal(Goal { param_env, predicate: (lhs, rhs, direction) })
}
ty::PredicateKind::AliasRelate(lhs, rhs, direction) => self
.compute_alias_relate_goal(Goal {
param_env,
predicate: (lhs, rhs, direction),
}),
}
} else {
let kind = self.infcx.instantiate_binder_with_placeholders(kind);

View file

@ -73,7 +73,7 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentCtxt<'tcx> {
MismatchedProjectionTypes { err: TypeError::Mismatch },
)
}
ty::PredicateKind::AliasEq(_, _, _) => {
ty::PredicateKind::AliasRelate(_, _, _) => {
FulfillmentErrorCode::CodeProjectionError(
MismatchedProjectionTypes { err: TypeError::Mismatch },
)

View file

@ -156,7 +156,7 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
}
#[instrument(level = "debug", skip(self), ret)]
fn compute_alias_eq_goal(
fn compute_alias_relate_goal(
&mut self,
goal: Goal<'tcx, (ty::Term<'tcx>, ty::Term<'tcx>, ty::AliasRelationDirection)>,
) -> QueryResult<'tcx> {
@ -204,12 +204,12 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
if lhs.is_infer() || rhs.is_infer() {
bug!(
"`AliasEq` goal with an infer var on lhs or rhs which should have been instantiated"
"`AliasRelate` goal with an infer var on lhs or rhs which should have been instantiated"
);
}
match (lhs.to_projection_term(tcx), rhs.to_projection_term(tcx)) {
(None, None) => bug!("`AliasEq` goal without an alias on either lhs or rhs"),
(None, None) => bug!("`AliasRelate` goal without an alias on either lhs or rhs"),
// RHS is not a projection, only way this is true is if LHS normalizes-to RHS
(Some(alias_lhs), None) => evaluate_normalizes_to(self, alias_lhs, rhs, direction),
@ -220,7 +220,7 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
}
(Some(alias_lhs), Some(alias_rhs)) => {
debug!("compute_alias_eq_goal: both sides are aliases");
debug!("compute_alias_relate_goal: both sides are aliases");
let candidates = vec![
// LHS normalizes-to RHS
@ -229,7 +229,9 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
evaluate_normalizes_to(self, alias_rhs, lhs, direction.invert()),
// Relate via substs
self.probe(|ecx| {
debug!("compute_alias_eq_goal: alias defids are equal, equating substs");
debug!(
"compute_alias_relate_goal: alias defids are equal, equating substs"
);
ecx.add_goals(
match direction {

View file

@ -832,7 +832,7 @@ impl<'tcx> AutoTraitFinder<'tcx> {
// the `ParamEnv`.
ty::PredicateKind::WellFormed(..)
| ty::PredicateKind::Clause(ty::Clause::ConstArgHasType(..))
| ty::PredicateKind::AliasEq(..)
| ty::PredicateKind::AliasRelate(..)
| ty::PredicateKind::ObjectSafe(..)
| ty::PredicateKind::ClosureKind(..)
| ty::PredicateKind::Subtype(..)

View file

@ -1276,9 +1276,9 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
"TypeWellFormedFromEnv predicate should only exist in the environment"
),
ty::PredicateKind::AliasEq(..) => span_bug!(
ty::PredicateKind::AliasRelate(..) => span_bug!(
span,
"AliasEq predicate should never be the predicate cause of a SelectionError"
"AliasRelate predicate should never be the predicate cause of a SelectionError"
),
ty::PredicateKind::Clause(ty::Clause::ConstArgHasType(ct, ty)) => {

View file

@ -361,8 +361,8 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
ty::PredicateKind::TypeWellFormedFromEnv(..) => {
bug!("TypeWellFormedFromEnv is only used for Chalk")
}
ty::PredicateKind::AliasEq(..) => {
bug!("AliasEq is only used for new solver")
ty::PredicateKind::AliasRelate(..) => {
bug!("AliasRelate is only used for new solver")
}
},
Some(pred) => match pred {
@ -630,8 +630,8 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
ty::PredicateKind::TypeWellFormedFromEnv(..) => {
bug!("TypeWellFormedFromEnv is only used for Chalk")
}
ty::PredicateKind::AliasEq(..) => {
bug!("AliasEq is only used for new solver")
ty::PredicateKind::AliasRelate(..) => {
bug!("AliasRelate is only used for new solver")
}
ty::PredicateKind::Clause(ty::Clause::ConstArgHasType(ct, ty)) => {
match self.selcx.infcx.at(&obligation.cause, obligation.param_env).eq(

View file

@ -335,7 +335,7 @@ fn predicate_references_self<'tcx>(
has_self_ty(&ty.into()).then_some(sp)
}
ty::PredicateKind::AliasEq(..) => bug!("`AliasEq` not allowed as assumption"),
ty::PredicateKind::AliasRelate(..) => bug!("`AliasRelate` not allowed as assumption"),
ty::PredicateKind::WellFormed(..)
| ty::PredicateKind::ObjectSafe(..)
@ -395,7 +395,7 @@ fn generics_require_sized_self(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
| ty::PredicateKind::Clause(ty::Clause::TypeOutlives(..))
| ty::PredicateKind::ConstEvaluatable(..)
| ty::PredicateKind::ConstEquate(..)
| ty::PredicateKind::AliasEq(..)
| ty::PredicateKind::AliasRelate(..)
| ty::PredicateKind::Ambiguous
| ty::PredicateKind::TypeWellFormedFromEnv(..) => false,
}

View file

@ -977,8 +977,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
ty::PredicateKind::TypeWellFormedFromEnv(..) => {
bug!("TypeWellFormedFromEnv is only used for chalk")
}
ty::PredicateKind::AliasEq(..) => {
bug!("AliasEq is only used for new solver")
ty::PredicateKind::AliasRelate(..) => {
bug!("AliasRelate is only used for new solver")
}
ty::PredicateKind::Ambiguous => Ok(EvaluatedToAmbig),
ty::PredicateKind::Clause(ty::Clause::ConstArgHasType(ct, ty)) => {

View file

@ -191,8 +191,8 @@ pub fn predicate_obligations<'tcx>(
ty::PredicateKind::TypeWellFormedFromEnv(..) => {
bug!("TypeWellFormedFromEnv is only used for Chalk")
}
ty::PredicateKind::AliasEq(..) => {
bug!("We should only wf check where clauses and `AliasEq` is not a `Clause`")
ty::PredicateKind::AliasRelate(..) => {
bug!("We should only wf check where clauses and `AliasRelate` is not a `Clause`")
}
}
@ -936,7 +936,7 @@ pub(crate) fn required_region_bounds<'tcx>(
| ty::PredicateKind::ConstEvaluatable(..)
| ty::PredicateKind::ConstEquate(..)
| ty::PredicateKind::Ambiguous
| ty::PredicateKind::AliasEq(..)
| ty::PredicateKind::AliasRelate(..)
| ty::PredicateKind::TypeWellFormedFromEnv(..) => None,
ty::PredicateKind::Clause(ty::Clause::TypeOutlives(ty::OutlivesPredicate(
ref t,