rename instantiate_binder_with_placeholders
This commit is contained in:
parent
ac559af98f
commit
b181a12623
10 changed files with 38 additions and 23 deletions
|
@ -140,7 +140,7 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentCtxt<'tcx> {
|
|||
)
|
||||
}
|
||||
ty::PredicateKind::Subtype(pred) => {
|
||||
let (a, b) = infcx.instantiate_binder_with_placeholders(
|
||||
let (a, b) = infcx.enter_forall_and_leak_universe(
|
||||
goal.predicate.kind().rebind((pred.a, pred.b)),
|
||||
);
|
||||
let expected_found = ExpectedFound::new(true, a, b);
|
||||
|
@ -150,7 +150,7 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentCtxt<'tcx> {
|
|||
)
|
||||
}
|
||||
ty::PredicateKind::Coerce(pred) => {
|
||||
let (a, b) = infcx.instantiate_binder_with_placeholders(
|
||||
let (a, b) = infcx.enter_forall_and_leak_universe(
|
||||
goal.predicate.kind().rebind((pred.a, pred.b)),
|
||||
);
|
||||
let expected_found = ExpectedFound::new(false, a, b);
|
||||
|
|
|
@ -358,8 +358,7 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
|
|||
| ty::PredicateKind::Coerce(_)
|
||||
| ty::PredicateKind::Clause(ty::ClauseKind::ConstEvaluatable(..))
|
||||
| ty::PredicateKind::ConstEquate(..) => {
|
||||
let pred =
|
||||
ty::Binder::dummy(infcx.instantiate_binder_with_placeholders(binder));
|
||||
let pred = ty::Binder::dummy(infcx.enter_forall_and_leak_universe(binder));
|
||||
ProcessResult::Changed(mk_pending(vec![obligation.with(infcx.tcx, pred)]))
|
||||
}
|
||||
ty::PredicateKind::Ambiguous => ProcessResult::Unchanged,
|
||||
|
|
|
@ -250,8 +250,7 @@ pub(super) fn poly_project_and_unify_type<'cx, 'tcx>(
|
|||
let infcx = selcx.infcx;
|
||||
let r = infcx.commit_if_ok(|_snapshot| {
|
||||
let old_universe = infcx.universe();
|
||||
let placeholder_predicate =
|
||||
infcx.instantiate_binder_with_placeholders(obligation.predicate);
|
||||
let placeholder_predicate = infcx.enter_forall_and_leak_universe(obligation.predicate);
|
||||
let new_universe = infcx.universe();
|
||||
|
||||
let placeholder_obligation = obligation.with(infcx.tcx, placeholder_predicate);
|
||||
|
|
|
@ -729,7 +729,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
self.infcx.probe(|_snapshot| {
|
||||
let poly_trait_predicate = self.infcx.resolve_vars_if_possible(obligation.predicate);
|
||||
let placeholder_trait_predicate =
|
||||
self.infcx.instantiate_binder_with_placeholders(poly_trait_predicate);
|
||||
self.infcx.enter_forall_and_leak_universe(poly_trait_predicate);
|
||||
|
||||
let self_ty = placeholder_trait_predicate.self_ty();
|
||||
let principal_trait_ref = match self_ty.kind() {
|
||||
|
|
|
@ -159,7 +159,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
|
||||
let trait_predicate = self.infcx.shallow_resolve(obligation.predicate);
|
||||
let placeholder_trait_predicate =
|
||||
self.infcx.instantiate_binder_with_placeholders(trait_predicate).trait_ref;
|
||||
self.infcx.enter_forall_and_leak_universe(trait_predicate).trait_ref;
|
||||
let placeholder_self_ty = placeholder_trait_predicate.self_ty();
|
||||
let placeholder_trait_predicate = ty::Binder::dummy(placeholder_trait_predicate);
|
||||
let (def_id, args) = match *placeholder_self_ty.kind() {
|
||||
|
@ -402,7 +402,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
let cause = obligation.derived_cause(BuiltinDerivedObligation);
|
||||
|
||||
let poly_trait_ref = obligation.predicate.to_poly_trait_ref();
|
||||
let trait_ref = self.infcx.instantiate_binder_with_placeholders(poly_trait_ref);
|
||||
let trait_ref = self.infcx.enter_forall_and_leak_universe(poly_trait_ref);
|
||||
let trait_obligations: Vec<PredicateObligation<'_>> = self.impl_or_trait_obligations(
|
||||
&cause,
|
||||
obligation.recursion_depth + 1,
|
||||
|
@ -493,7 +493,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
let tcx = self.tcx();
|
||||
debug!(?obligation, ?index, "confirm_object_candidate");
|
||||
|
||||
let trait_predicate = self.infcx.instantiate_binder_with_placeholders(obligation.predicate);
|
||||
let trait_predicate = self.infcx.enter_forall_and_leak_universe(obligation.predicate);
|
||||
let self_ty = self.infcx.shallow_resolve(trait_predicate.self_ty());
|
||||
let obligation_trait_ref = ty::Binder::dummy(trait_predicate.trait_ref);
|
||||
let ty::Dynamic(data, ..) = *self_ty.kind() else {
|
||||
|
@ -691,7 +691,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
let cause = obligation.derived_cause(BuiltinDerivedObligation);
|
||||
|
||||
// Confirm the `type Output: Sized;` bound that is present on `FnOnce`
|
||||
let output_ty = self.infcx.instantiate_binder_with_placeholders(sig.output());
|
||||
let output_ty = self.infcx.enter_forall_and_leak_universe(sig.output());
|
||||
let output_ty = normalize_with_depth_to(
|
||||
self,
|
||||
obligation.param_env,
|
||||
|
@ -712,7 +712,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
) -> Vec<PredicateObligation<'tcx>> {
|
||||
debug!(?obligation, "confirm_trait_alias_candidate");
|
||||
|
||||
let predicate = self.infcx.instantiate_binder_with_placeholders(obligation.predicate);
|
||||
let predicate = self.infcx.enter_forall_and_leak_universe(obligation.predicate);
|
||||
let trait_ref = predicate.trait_ref;
|
||||
let trait_def_id = trait_ref.def_id;
|
||||
let args = trait_ref.args;
|
||||
|
|
|
@ -1606,7 +1606,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
) -> smallvec::SmallVec<[usize; 2]> {
|
||||
let poly_trait_predicate = self.infcx.resolve_vars_if_possible(obligation.predicate);
|
||||
let placeholder_trait_predicate =
|
||||
self.infcx.instantiate_binder_with_placeholders(poly_trait_predicate);
|
||||
self.infcx.enter_forall_and_leak_universe(poly_trait_predicate);
|
||||
debug!(?placeholder_trait_predicate);
|
||||
|
||||
let tcx = self.infcx.tcx;
|
||||
|
@ -2386,7 +2386,7 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
|
|||
.flat_map(|ty| {
|
||||
let ty: ty::Binder<'tcx, Ty<'tcx>> = types.rebind(*ty); // <----/
|
||||
|
||||
let placeholder_ty = self.infcx.instantiate_binder_with_placeholders(ty);
|
||||
let placeholder_ty = self.infcx.enter_forall_and_leak_universe(ty);
|
||||
let Normalized { value: normalized_ty, mut obligations } =
|
||||
ensure_sufficient_stack(|| {
|
||||
project::normalize_with_depth(
|
||||
|
@ -2472,7 +2472,7 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
|
|||
obligation: &PolyTraitObligation<'tcx>,
|
||||
) -> Result<Normalized<'tcx, GenericArgsRef<'tcx>>, ()> {
|
||||
let placeholder_obligation =
|
||||
self.infcx.instantiate_binder_with_placeholders(obligation.predicate);
|
||||
self.infcx.enter_forall_and_leak_universe(obligation.predicate);
|
||||
let placeholder_obligation_trait_ref = placeholder_obligation.trait_ref;
|
||||
|
||||
let impl_args = self.infcx.fresh_args_for_item(obligation.cause.span, impl_def_id);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue