Rollup merge of #104775 - spastorino:use-obligation-ctxt-normalize, r=lcnr
Use ObligationCtxt::normalize r? ```@lcnr```
This commit is contained in:
commit
2190b163a3
1 changed files with 4 additions and 17 deletions
|
@ -218,14 +218,11 @@ fn compare_predicate_entailment<'tcx>(
|
||||||
|
|
||||||
debug!("compare_impl_method: caller_bounds={:?}", param_env.caller_bounds());
|
debug!("compare_impl_method: caller_bounds={:?}", param_env.caller_bounds());
|
||||||
|
|
||||||
let mut selcx = traits::SelectionContext::new(&infcx);
|
|
||||||
let impl_m_own_bounds = impl_m_predicates.instantiate_own(tcx, impl_to_placeholder_substs);
|
let impl_m_own_bounds = impl_m_predicates.instantiate_own(tcx, impl_to_placeholder_substs);
|
||||||
for (predicate, span) in iter::zip(impl_m_own_bounds.predicates, impl_m_own_bounds.spans) {
|
for (predicate, span) in iter::zip(impl_m_own_bounds.predicates, impl_m_own_bounds.spans) {
|
||||||
let normalize_cause = traits::ObligationCause::misc(span, impl_m_hir_id);
|
let normalize_cause = traits::ObligationCause::misc(span, impl_m_hir_id);
|
||||||
let traits::Normalized { value: predicate, obligations } =
|
let predicate = ocx.normalize(normalize_cause, param_env, predicate);
|
||||||
traits::normalize(&mut selcx, param_env, normalize_cause, predicate);
|
|
||||||
|
|
||||||
ocx.register_obligations(obligations);
|
|
||||||
let cause = ObligationCause::new(
|
let cause = ObligationCause::new(
|
||||||
span,
|
span,
|
||||||
impl_m_hir_id,
|
impl_m_hir_id,
|
||||||
|
@ -1555,14 +1552,11 @@ fn compare_type_predicate_entailment<'tcx>(
|
||||||
|
|
||||||
debug!("compare_type_predicate_entailment: caller_bounds={:?}", param_env.caller_bounds());
|
debug!("compare_type_predicate_entailment: caller_bounds={:?}", param_env.caller_bounds());
|
||||||
|
|
||||||
let mut selcx = traits::SelectionContext::new(&infcx);
|
|
||||||
|
|
||||||
assert_eq!(impl_ty_own_bounds.predicates.len(), impl_ty_own_bounds.spans.len());
|
assert_eq!(impl_ty_own_bounds.predicates.len(), impl_ty_own_bounds.spans.len());
|
||||||
for (span, predicate) in std::iter::zip(impl_ty_own_bounds.spans, impl_ty_own_bounds.predicates)
|
for (span, predicate) in std::iter::zip(impl_ty_own_bounds.spans, impl_ty_own_bounds.predicates)
|
||||||
{
|
{
|
||||||
let cause = ObligationCause::misc(span, impl_ty_hir_id);
|
let cause = ObligationCause::misc(span, impl_ty_hir_id);
|
||||||
let traits::Normalized { value: predicate, obligations } =
|
let predicate = ocx.normalize(cause, param_env, predicate);
|
||||||
traits::normalize(&mut selcx, param_env, cause, predicate);
|
|
||||||
|
|
||||||
let cause = ObligationCause::new(
|
let cause = ObligationCause::new(
|
||||||
span,
|
span,
|
||||||
|
@ -1573,7 +1567,6 @@ fn compare_type_predicate_entailment<'tcx>(
|
||||||
kind: impl_ty.kind,
|
kind: impl_ty.kind,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
ocx.register_obligations(obligations);
|
|
||||||
ocx.register_obligation(traits::Obligation::new(tcx, cause, param_env, predicate));
|
ocx.register_obligation(traits::Obligation::new(tcx, cause, param_env, predicate));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1756,7 +1749,6 @@ pub fn check_type_bounds<'tcx>(
|
||||||
let assumed_wf_types =
|
let assumed_wf_types =
|
||||||
ocx.assumed_wf_types(param_env, impl_ty_span, impl_ty.def_id.expect_local());
|
ocx.assumed_wf_types(param_env, impl_ty_span, impl_ty.def_id.expect_local());
|
||||||
|
|
||||||
let mut selcx = traits::SelectionContext::new(&infcx);
|
|
||||||
let normalize_cause = ObligationCause::new(
|
let normalize_cause = ObligationCause::new(
|
||||||
impl_ty_span,
|
impl_ty_span,
|
||||||
impl_ty_hir_id,
|
impl_ty_hir_id,
|
||||||
|
@ -1785,16 +1777,11 @@ pub fn check_type_bounds<'tcx>(
|
||||||
debug!("check_type_bounds: item_bounds={:?}", obligations);
|
debug!("check_type_bounds: item_bounds={:?}", obligations);
|
||||||
|
|
||||||
for mut obligation in util::elaborate_obligations(tcx, obligations) {
|
for mut obligation in util::elaborate_obligations(tcx, obligations) {
|
||||||
let traits::Normalized { value: normalized_predicate, obligations } = traits::normalize(
|
let normalized_predicate =
|
||||||
&mut selcx,
|
ocx.normalize(normalize_cause.clone(), normalize_param_env, obligation.predicate);
|
||||||
normalize_param_env,
|
|
||||||
normalize_cause.clone(),
|
|
||||||
obligation.predicate,
|
|
||||||
);
|
|
||||||
debug!("compare_projection_bounds: normalized predicate = {:?}", normalized_predicate);
|
debug!("compare_projection_bounds: normalized predicate = {:?}", normalized_predicate);
|
||||||
obligation.predicate = normalized_predicate;
|
obligation.predicate = normalized_predicate;
|
||||||
|
|
||||||
ocx.register_obligations(obligations);
|
|
||||||
ocx.register_obligation(obligation);
|
ocx.register_obligation(obligation);
|
||||||
}
|
}
|
||||||
// Check that all obligations are satisfied by the implementation's
|
// Check that all obligations are satisfied by the implementation's
|
||||||
|
|
Loading…
Add table
Reference in a new issue