no leak_check -> commit_unconditionally is noop
This commit is contained in:
parent
748cb1f01d
commit
c12f5fc006
2 changed files with 163 additions and 182 deletions
|
@ -158,7 +158,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
obligation: &TraitObligation<'tcx>,
|
||||
idx: usize,
|
||||
) -> Result<Vec<PredicateObligation<'tcx>>, SelectionError<'tcx>> {
|
||||
self.infcx.commit_unconditionally(|_| {
|
||||
let tcx = self.tcx();
|
||||
|
||||
let trait_predicate = self.infcx.shallow_resolve(obligation.predicate);
|
||||
|
@ -218,7 +217,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
}
|
||||
|
||||
Ok(obligations)
|
||||
})
|
||||
}
|
||||
|
||||
fn confirm_param_candidate(
|
||||
|
@ -314,19 +312,16 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
ensure_sufficient_stack(|| {
|
||||
let cause = obligation.derived_cause(BuiltinDerivedObligation);
|
||||
|
||||
let trait_obligations: Vec<PredicateObligation<'_>> =
|
||||
self.infcx.commit_unconditionally(|_| {
|
||||
let poly_trait_ref = obligation.predicate.to_poly_trait_ref();
|
||||
let trait_ref = self.infcx.replace_bound_vars_with_placeholders(poly_trait_ref);
|
||||
self.impl_or_trait_obligations(
|
||||
let trait_obligations: Vec<PredicateObligation<'_>> = self.impl_or_trait_obligations(
|
||||
&cause,
|
||||
obligation.recursion_depth + 1,
|
||||
obligation.param_env,
|
||||
trait_def_id,
|
||||
&trait_ref.substs,
|
||||
obligation.predicate,
|
||||
)
|
||||
});
|
||||
);
|
||||
|
||||
let mut obligations = self.collect_predicates_for_types(
|
||||
obligation.param_env,
|
||||
|
@ -355,7 +350,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
|
||||
// First, create the substitutions by matching the impl again,
|
||||
// this time not in a probe.
|
||||
self.infcx.commit_unconditionally(|_| {
|
||||
let substs = self.rematch_impl(impl_def_id, obligation);
|
||||
debug!(?substs, "impl substs");
|
||||
ensure_sufficient_stack(|| {
|
||||
|
@ -368,7 +362,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
obligation.predicate,
|
||||
)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
fn vtable_impl(
|
||||
|
@ -614,7 +607,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
) -> ImplSourceTraitAliasData<'tcx, PredicateObligation<'tcx>> {
|
||||
debug!(?obligation, ?alias_def_id, "confirm_trait_alias_candidate");
|
||||
|
||||
self.infcx.commit_unconditionally(|_| {
|
||||
let predicate = self.infcx().replace_bound_vars_with_placeholders(obligation.predicate);
|
||||
let trait_ref = predicate.trait_ref;
|
||||
let trait_def_id = trait_ref.def_id;
|
||||
|
@ -632,7 +624,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
debug!(?trait_def_id, ?trait_obligations, "trait alias obligations");
|
||||
|
||||
ImplSourceTraitAliasData { alias_def_id, substs, nested: trait_obligations }
|
||||
})
|
||||
}
|
||||
|
||||
fn confirm_generator_candidate(
|
||||
|
@ -730,7 +721,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
// Normalize the obligation and expected trait refs together, because why not
|
||||
let Normalized { obligations: nested, value: (obligation_trait_ref, expected_trait_ref) } =
|
||||
ensure_sufficient_stack(|| {
|
||||
self.infcx.commit_unconditionally(|_| {
|
||||
normalize_with_depth(
|
||||
self,
|
||||
obligation.param_env,
|
||||
|
@ -738,7 +728,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
obligation.recursion_depth + 1,
|
||||
(obligation_trait_ref, expected_trait_ref),
|
||||
)
|
||||
})
|
||||
});
|
||||
|
||||
self.infcx
|
||||
|
@ -1114,7 +1103,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
// first check it like a regular impl candidate.
|
||||
// This is copied from confirm_impl_candidate but remaps the predicate to `~const Drop` beforehand.
|
||||
if let Some(impl_def_id) = impl_def_id {
|
||||
let obligations = self.infcx.commit_unconditionally(|_| {
|
||||
let mut new_obligation = obligation.clone();
|
||||
new_obligation.predicate = new_obligation.predicate.map_bound(|mut trait_pred| {
|
||||
trait_pred.trait_ref.def_id = drop_trait;
|
||||
|
@ -1130,7 +1118,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
span: obligation.cause.span,
|
||||
}))
|
||||
});
|
||||
ensure_sufficient_stack(|| {
|
||||
let obligations = ensure_sufficient_stack(|| {
|
||||
self.vtable_impl(
|
||||
impl_def_id,
|
||||
substs,
|
||||
|
@ -1139,7 +1127,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
new_obligation.param_env,
|
||||
obligation.predicate,
|
||||
)
|
||||
})
|
||||
});
|
||||
nested.extend(obligations.nested);
|
||||
}
|
||||
|
@ -1190,7 +1177,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
// If we have a projection type, make sure to normalize it so we replace it
|
||||
// with a fresh infer variable
|
||||
ty::Projection(..) => {
|
||||
self.infcx.commit_unconditionally(|_| {
|
||||
let predicate = normalize_with_depth_to(
|
||||
self,
|
||||
obligation.param_env,
|
||||
|
@ -1199,9 +1185,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
self_ty
|
||||
.rebind(ty::TraitPredicate {
|
||||
trait_ref: ty::TraitRef {
|
||||
def_id: self
|
||||
.tcx()
|
||||
.require_lang_item(LangItem::Destruct, None),
|
||||
def_id: self.tcx().require_lang_item(LangItem::Destruct, None),
|
||||
substs: self.tcx().mk_substs_trait(nested_ty, &[]),
|
||||
},
|
||||
constness: ty::BoundConstness::ConstIfConst,
|
||||
|
@ -1217,7 +1201,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
obligation.param_env,
|
||||
predicate,
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
// If we have any other type (e.g. an ADT), just register a nested obligation
|
||||
|
|
|
@ -2081,7 +2081,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
.flat_map(|ty| {
|
||||
let ty: ty::Binder<'tcx, Ty<'tcx>> = types.rebind(*ty); // <----/
|
||||
|
||||
self.infcx.commit_unconditionally(|_| {
|
||||
let placeholder_ty = self.infcx.replace_bound_vars_with_placeholders(ty);
|
||||
let Normalized { value: normalized_ty, mut obligations } =
|
||||
ensure_sufficient_stack(|| {
|
||||
|
@ -2105,7 +2104,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
obligations.push(placeholder_obligation);
|
||||
obligations
|
||||
})
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue