1
Fork 0

Make P parameter explicit

This commit is contained in:
Michael Goulet 2024-05-15 10:08:35 -04:00
parent 11ec3eca74
commit 412dc28d6a
14 changed files with 62 additions and 49 deletions

View file

@ -2703,7 +2703,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
obligated_types: &mut Vec<Ty<'tcx>>,
seen_requirements: &mut FxHashSet<DefId>,
) where
T: Upcast<'tcx>,
T: Upcast<'tcx, ty::Predicate<'tcx>>,
{
let mut long_ty_file = None;

View file

@ -302,7 +302,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
suggest_increasing_limit: bool,
) -> !
where
T: Upcast<'tcx> + Clone,
T: Upcast<'tcx, ty::Predicate<'tcx>> + Clone,
{
let predicate = obligation.predicate.clone().upcast(self.tcx);
let predicate = self.resolve_vars_if_possible(predicate);

View file

@ -142,7 +142,7 @@ pub fn type_known_to_meet_bound_modulo_regions<'tcx>(
fn pred_known_to_hold_modulo_regions<'tcx>(
infcx: &InferCtxt<'tcx>,
param_env: ty::ParamEnv<'tcx>,
pred: impl Upcast<'tcx>,
pred: impl Upcast<'tcx, ty::Predicate<'tcx>>,
) -> bool {
let obligation = Obligation::new(infcx.tcx, ObligationCause::dummy(), param_env, pred);

View file

@ -752,8 +752,7 @@ fn receiver_is_dispatchable<'tcx>(
// Self: Unsize<U>
let unsize_predicate =
ty::TraitRef::new(tcx, unsize_did, [tcx.types.self_param, unsized_self_ty])
.upcast(tcx);
ty::TraitRef::new(tcx, unsize_did, [tcx.types.self_param, unsized_self_ty]).upcast(tcx);
// U: Trait<Arg1, ..., ArgN>
let trait_predicate = {

View file

@ -739,8 +739,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
// stack would be `T: Auto`.
let cycle = stack.iter().take_while(|s| s.depth > stack_arg.1);
let tcx = self.tcx();
let cycle =
cycle.map(|stack| stack.obligation.predicate.upcast(tcx));
let cycle = cycle.map(|stack| stack.obligation.predicate.upcast(tcx));
if self.coinductive_match(cycle) {
stack.update_reached_depth(stack_arg.1);
return Ok(EvaluatedToOk);
@ -1379,7 +1378,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
error_obligation: &Obligation<'tcx, T>,
) -> Result<(), OverflowError>
where
T: Upcast<'tcx> + Clone,
T: Upcast<'tcx, ty::Predicate<'tcx>> + Clone,
{
if !self.infcx.tcx.recursion_limit().value_within_limit(depth) {
match self.query_mode {
@ -1408,7 +1407,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
error_obligation: &Obligation<'tcx, V>,
) -> Result<(), OverflowError>
where
V: Upcast<'tcx> + Clone,
V: Upcast<'tcx, ty::Predicate<'tcx>> + Clone,
{
self.check_recursion_depth(obligation.recursion_depth, error_obligation)
}