Skip to content

Commit

Permalink
remove _types from ocx method names
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors committed Oct 27, 2022
1 parent ce11ae5 commit 2f9794b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 14 deletions.
9 changes: 4 additions & 5 deletions compiler/rustc_hir_analysis/src/check/compare_method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,17 +290,16 @@ fn compare_predicate_entailment<'tcx>(
// 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.
// 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
// RPITITs, we need to equate the output tys instead of just subtyping. If
// we just use `sup` above, we'll end up `&'static str <: _#1t`, which causes
// us to infer `_#1t = #'_#2r str`, where `'_#2r` is unconstrained, which gets
// fixed up to `ReEmpty`, and which is certainly not what we want.
if trait_fty.has_infer_types() {
result = result.and_then(|()| {
ocx.equate_types(&cause, param_env, trait_sig.output(), impl_sig.output())
});
result =
result.and_then(|()| ocx.eq(&cause, param_env, trait_sig.output(), impl_sig.output()));
}

if let Err(terr) = result {
Expand Down Expand Up @@ -1383,7 +1382,7 @@ pub(crate) fn raw_compare_const_impl<'tcx>(

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 {
debug!(
Expand Down
6 changes: 2 additions & 4 deletions compiler/rustc_hir_analysis/src/check/wfcheck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1675,7 +1675,7 @@ fn receiver_is_valid<'tcx>(

// `self: Self` is always valid.
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();
}
return true;
Expand Down Expand Up @@ -1705,9 +1705,7 @@ fn receiver_is_valid<'tcx>(
if can_eq_self(potential_self_ty) {
wfcx.register_obligations(autoderef.into_obligations());

if let Err(err) =
wfcx.equate_types(&cause, wfcx.param_env, self_ty, potential_self_ty)
{
if let Err(err) = wfcx.eq(&cause, wfcx.param_env, self_ty, potential_self_ty) {
infcx
.err_ctxt()
.report_mismatched_types(&cause, self_ty, potential_self_ty, err)
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_trait_selection/src/traits/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ impl<'a, 'tcx> ObligationCtxt<'a, 'tcx> {
self.register_infer_ok_obligations(infer_ok)
}

pub fn equate_types<T: ToTrace<'tcx>>(
pub fn eq<T: ToTrace<'tcx>>(
&self,
cause: &ObligationCause<'tcx>,
param_env: ty::ParamEnv<'tcx>,
Expand All @@ -128,7 +128,7 @@ impl<'a, 'tcx> ObligationCtxt<'a, 'tcx> {
}
}

pub fn sup_types<T: ToTrace<'tcx>>(
pub fn sup<T: ToTrace<'tcx>>(
&self,
cause: &ObligationCause<'tcx>,
param_env: ty::ParamEnv<'tcx>,
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_traits/src/type_op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ impl<'me, 'tcx> AscribeUserTypeCx<'me, 'tcx> {
where
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>) {
Expand Down Expand Up @@ -176,7 +176,7 @@ fn type_op_eq<'tcx>(
) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, ()>>, NoSolution> {
tcx.infer_ctxt().enter_canonical_trait_query(&canonicalized, |ocx, key| {
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)?)
})
}

Expand Down Expand Up @@ -228,7 +228,7 @@ fn type_op_subtype<'tcx>(
) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, ()>>, NoSolution> {
tcx.infer_ctxt().enter_canonical_trait_query(&canonicalized, |ocx, key| {
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)?)
})
}

Expand Down

0 comments on commit 2f9794b

Please sign in to comment.