remove _types from ocx method names

This commit is contained in:
Michael Goulet 2022-10-27 15:41:50 +00:00
parent ce11ae5d0d
commit 2f9794b84a
4 changed files with 11 additions and 14 deletions

View File

@ -290,7 +290,7 @@ fn compare_predicate_entailment<'tcx>(
// type would be more appropriate. In other places we have a `Vec<Span>` // type would be more appropriate. In other places we have a `Vec<Span>`
// corresponding to their `Vec<Predicate>`, but we don't have that here. // corresponding to their `Vec<Predicate>`, but we don't have that here.
// Fixing this would improve the output of test `issue-83765.rs`. // Fixing this would improve the output of test `issue-83765.rs`.
let mut result = ocx.sup_types(&cause, param_env, trait_fty, impl_fty); let mut result = ocx.sup(&cause, param_env, trait_fty, impl_fty);
// HACK(RPITIT): #101614. When we are trying to infer the hidden types for // HACK(RPITIT): #101614. When we are trying to infer the hidden types for
// RPITITs, we need to equate the output tys instead of just subtyping. If // RPITITs, we need to equate the output tys instead of just subtyping. If
@ -298,9 +298,8 @@ fn compare_predicate_entailment<'tcx>(
// us to infer `_#1t = #'_#2r str`, where `'_#2r` is unconstrained, which gets // us to infer `_#1t = #'_#2r str`, where `'_#2r` is unconstrained, which gets
// fixed up to `ReEmpty`, and which is certainly not what we want. // fixed up to `ReEmpty`, and which is certainly not what we want.
if trait_fty.has_infer_types() { if trait_fty.has_infer_types() {
result = result.and_then(|()| { result =
ocx.equate_types(&cause, param_env, trait_sig.output(), impl_sig.output()) result.and_then(|()| ocx.eq(&cause, param_env, trait_sig.output(), impl_sig.output()));
});
} }
if let Err(terr) = result { if let Err(terr) = result {
@ -1383,7 +1382,7 @@ pub(crate) fn raw_compare_const_impl<'tcx>(
debug!("compare_const_impl: trait_ty={:?}", trait_ty); debug!("compare_const_impl: trait_ty={:?}", trait_ty);
let err = ocx.sup_types(&cause, param_env, trait_ty, impl_ty); let err = ocx.sup(&cause, param_env, trait_ty, impl_ty);
if let Err(terr) = err { if let Err(terr) = err {
debug!( debug!(

View File

@ -1675,7 +1675,7 @@ fn receiver_is_valid<'tcx>(
// `self: Self` is always valid. // `self: Self` is always valid.
if can_eq_self(receiver_ty) { if can_eq_self(receiver_ty) {
if let Err(err) = wfcx.equate_types(&cause, wfcx.param_env, self_ty, receiver_ty) { if let Err(err) = wfcx.eq(&cause, wfcx.param_env, self_ty, receiver_ty) {
infcx.err_ctxt().report_mismatched_types(&cause, self_ty, receiver_ty, err).emit(); infcx.err_ctxt().report_mismatched_types(&cause, self_ty, receiver_ty, err).emit();
} }
return true; return true;
@ -1705,9 +1705,7 @@ fn receiver_is_valid<'tcx>(
if can_eq_self(potential_self_ty) { if can_eq_self(potential_self_ty) {
wfcx.register_obligations(autoderef.into_obligations()); wfcx.register_obligations(autoderef.into_obligations());
if let Err(err) = if let Err(err) = wfcx.eq(&cause, wfcx.param_env, self_ty, potential_self_ty) {
wfcx.equate_types(&cause, wfcx.param_env, self_ty, potential_self_ty)
{
infcx infcx
.err_ctxt() .err_ctxt()
.report_mismatched_types(&cause, self_ty, potential_self_ty, err) .report_mismatched_types(&cause, self_ty, potential_self_ty, err)

View File

@ -112,7 +112,7 @@ impl<'a, 'tcx> ObligationCtxt<'a, 'tcx> {
self.register_infer_ok_obligations(infer_ok) self.register_infer_ok_obligations(infer_ok)
} }
pub fn equate_types<T: ToTrace<'tcx>>( pub fn eq<T: ToTrace<'tcx>>(
&self, &self,
cause: &ObligationCause<'tcx>, cause: &ObligationCause<'tcx>,
param_env: ty::ParamEnv<'tcx>, param_env: ty::ParamEnv<'tcx>,
@ -128,7 +128,7 @@ impl<'a, 'tcx> ObligationCtxt<'a, 'tcx> {
} }
} }
pub fn sup_types<T: ToTrace<'tcx>>( pub fn sup<T: ToTrace<'tcx>>(
&self, &self,
cause: &ObligationCause<'tcx>, cause: &ObligationCause<'tcx>,
param_env: ty::ParamEnv<'tcx>, param_env: ty::ParamEnv<'tcx>,

View File

@ -87,7 +87,7 @@ impl<'me, 'tcx> AscribeUserTypeCx<'me, 'tcx> {
where where
T: ToTrace<'tcx>, T: ToTrace<'tcx>,
{ {
Ok(self.ocx.equate_types(&ObligationCause::dummy_with_span(self.span), self.param_env, a, b)?) Ok(self.ocx.eq(&ObligationCause::dummy_with_span(self.span), self.param_env, a, b)?)
} }
fn prove_predicate(&self, predicate: Predicate<'tcx>, cause: ObligationCause<'tcx>) { fn prove_predicate(&self, predicate: Predicate<'tcx>, cause: ObligationCause<'tcx>) {
@ -176,7 +176,7 @@ fn type_op_eq<'tcx>(
) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, ()>>, NoSolution> { ) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, ()>>, NoSolution> {
tcx.infer_ctxt().enter_canonical_trait_query(&canonicalized, |ocx, key| { tcx.infer_ctxt().enter_canonical_trait_query(&canonicalized, |ocx, key| {
let (param_env, Eq { a, b }) = key.into_parts(); let (param_env, Eq { a, b }) = key.into_parts();
Ok(ocx.equate_types(&ObligationCause::dummy(), param_env, a, b)?) Ok(ocx.eq(&ObligationCause::dummy(), param_env, a, b)?)
}) })
} }
@ -228,7 +228,7 @@ fn type_op_subtype<'tcx>(
) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, ()>>, NoSolution> { ) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, ()>>, NoSolution> {
tcx.infer_ctxt().enter_canonical_trait_query(&canonicalized, |ocx, key| { tcx.infer_ctxt().enter_canonical_trait_query(&canonicalized, |ocx, key| {
let (param_env, Subtype { sub, sup }) = key.into_parts(); let (param_env, Subtype { sub, sup }) = key.into_parts();
Ok(ocx.sup_types(&ObligationCause::dummy(), param_env, sup, sub)?) Ok(ocx.sup(&ObligationCause::dummy(), param_env, sup, sub)?)
}) })
} }