Rename to match similar methods
This commit is contained in:
parent
fef872a875
commit
7fd9beedc2
5 changed files with 8 additions and 8 deletions
|
@ -542,7 +542,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
ty::PredicateKind::Clause(ty::Clause::Trait(trait_pred)) => {
|
ty::PredicateKind::Clause(ty::Clause::Trait(trait_pred)) => {
|
||||||
assert_eq!(trait_pred.trait_ref.self_ty(), opaque_ty);
|
assert_eq!(trait_pred.trait_ref.self_ty(), opaque_ty);
|
||||||
ty::PredicateKind::Clause(ty::Clause::Trait(
|
ty::PredicateKind::Clause(ty::Clause::Trait(
|
||||||
trait_pred.with_self_type(self.tcx, ty),
|
trait_pred.with_self_ty(self.tcx, ty),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
ty::PredicateKind::Clause(ty::Clause::Projection(mut proj_pred)) => {
|
ty::PredicateKind::Clause(ty::Clause::Projection(mut proj_pred)) => {
|
||||||
|
|
|
@ -781,8 +781,8 @@ impl<'tcx> TraitPredicate<'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_self_type(self, tcx: TyCtxt<'tcx>, self_ty: Ty<'tcx>) -> Self {
|
pub fn with_self_ty(self, tcx: TyCtxt<'tcx>, self_ty: Ty<'tcx>) -> Self {
|
||||||
Self { trait_ref: self.trait_ref.with_self_type(tcx, self_ty), ..self }
|
Self { trait_ref: self.trait_ref.with_self_ty(tcx, self_ty), ..self }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn def_id(self) -> DefId {
|
pub fn def_id(self) -> DefId {
|
||||||
|
|
|
@ -823,7 +823,7 @@ impl<'tcx> TraitRef<'tcx> {
|
||||||
TraitRef { def_id, substs }
|
TraitRef { def_id, substs }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_self_type(self, tcx: TyCtxt<'tcx>, self_ty: Ty<'tcx>) -> Self {
|
pub fn with_self_ty(self, tcx: TyCtxt<'tcx>, self_ty: Ty<'tcx>) -> Self {
|
||||||
tcx.mk_trait_ref(
|
tcx.mk_trait_ref(
|
||||||
self.def_id,
|
self.def_id,
|
||||||
[self_ty.into()].into_iter().chain(self.substs.iter().skip(1)),
|
[self_ty.into()].into_iter().chain(self.substs.iter().skip(1)),
|
||||||
|
|
|
@ -1036,7 +1036,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||||
&& self.fallback_has_occurred
|
&& self.fallback_has_occurred
|
||||||
{
|
{
|
||||||
let predicate = trait_predicate.map_bound(|trait_pred| {
|
let predicate = trait_predicate.map_bound(|trait_pred| {
|
||||||
trait_pred.with_self_type(self.tcx, self.tcx.mk_unit())
|
trait_pred.with_self_ty(self.tcx, self.tcx.mk_unit())
|
||||||
});
|
});
|
||||||
let unit_obligation = obligation.with(tcx, predicate);
|
let unit_obligation = obligation.with(tcx, predicate);
|
||||||
if self.predicate_may_hold(&unit_obligation) {
|
if self.predicate_may_hold(&unit_obligation) {
|
||||||
|
@ -2085,8 +2085,8 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||||
param_env: ty::ParamEnv<'tcx>,
|
param_env: ty::ParamEnv<'tcx>,
|
||||||
trait_ref_and_ty: ty::Binder<'tcx, (ty::TraitPredicate<'tcx>, Ty<'tcx>)>,
|
trait_ref_and_ty: ty::Binder<'tcx, (ty::TraitPredicate<'tcx>, Ty<'tcx>)>,
|
||||||
) -> PredicateObligation<'tcx> {
|
) -> PredicateObligation<'tcx> {
|
||||||
let trait_pred = trait_ref_and_ty
|
let trait_pred =
|
||||||
.map_bound(|(tr, new_self_ty)| tr.with_self_type(self.tcx, new_self_ty));
|
trait_ref_and_ty.map_bound(|(tr, new_self_ty)| tr.with_self_ty(self.tcx, new_self_ty));
|
||||||
|
|
||||||
Obligation::new(self.tcx, ObligationCause::dummy(), param_env, trait_pred)
|
Obligation::new(self.tcx, ObligationCause::dummy(), param_env, trait_pred)
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ pub(crate) fn update<'tcx, T>(
|
||||||
.kind()
|
.kind()
|
||||||
.rebind(
|
.rebind(
|
||||||
// (*) binder moved here
|
// (*) binder moved here
|
||||||
ty::PredicateKind::Clause(ty::Clause::Trait(tpred.with_self_type(infcx.tcx, new_self_ty)))
|
ty::PredicateKind::Clause(ty::Clause::Trait(tpred.with_self_ty(infcx.tcx, new_self_ty)))
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
// Don't report overflow errors. Otherwise equivalent to may_hold.
|
// Don't report overflow errors. Otherwise equivalent to may_hold.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue