Rename ToPredicate for Upcast

This commit is contained in:
Michael Goulet 2024-05-15 10:05:25 -04:00
parent 97bf25c8cf
commit 11ec3eca74
44 changed files with 214 additions and 220 deletions

View file

@ -16,7 +16,7 @@ use rustc_hir as hir;
use rustc_middle::traits::query::NoSolution;
use rustc_middle::traits::solve::Certainty;
use rustc_middle::ty::error::{ExpectedFound, TypeError};
use rustc_middle::ty::{self, Const, ToPredicate, Ty, TyCtxt};
use rustc_middle::ty::{self, Const, Ty, TyCtxt, Upcast};
use rustc_span::Span;
pub use self::ImplSource::*;
@ -155,7 +155,7 @@ impl<'tcx, O> Obligation<'tcx, O> {
tcx: TyCtxt<'tcx>,
cause: ObligationCause<'tcx>,
param_env: ty::ParamEnv<'tcx>,
predicate: impl ToPredicate<'tcx, O>,
predicate: impl Upcast<'tcx, O>,
) -> Obligation<'tcx, O> {
Self::with_depth(tcx, cause, 0, param_env, predicate)
}
@ -173,9 +173,9 @@ impl<'tcx, O> Obligation<'tcx, O> {
cause: ObligationCause<'tcx>,
recursion_depth: usize,
param_env: ty::ParamEnv<'tcx>,
predicate: impl ToPredicate<'tcx, O>,
predicate: impl Upcast<'tcx, O>,
) -> Obligation<'tcx, O> {
let predicate = predicate.to_predicate(tcx);
let predicate = predicate.upcast(tcx);
Obligation { cause, param_env, recursion_depth, predicate }
}
@ -184,16 +184,12 @@ impl<'tcx, O> Obligation<'tcx, O> {
span: Span,
body_id: LocalDefId,
param_env: ty::ParamEnv<'tcx>,
trait_ref: impl ToPredicate<'tcx, O>,
trait_ref: impl Upcast<'tcx, O>,
) -> Obligation<'tcx, O> {
Obligation::new(tcx, ObligationCause::misc(span, body_id), param_env, trait_ref)
}
pub fn with<P>(
&self,
tcx: TyCtxt<'tcx>,
value: impl ToPredicate<'tcx, P>,
) -> Obligation<'tcx, P> {
pub fn with<P>(&self, tcx: TyCtxt<'tcx>, value: impl Upcast<'tcx, P>) -> Obligation<'tcx, P> {
Obligation::with_depth(tcx, self.cause.clone(), self.recursion_depth, self.param_env, value)
}
}