// Finally we register each of these predicates as an obligation in
// a fresh FulfillmentCtxt, and invoke select_all_or_error.
- // Create a parameter environment that represents the implementation's
- // method.
- let impl_param_env = tcx.parameter_environment(impl_m.def_id);
-
// Create mapping from impl to skolemized.
let impl_to_skol_substs = Substs::identity_for_item(tcx, impl_m.def_id);
// The key step here is to update the caller_bounds's predicates to be
// the new hybrid bounds we computed.
let normalize_cause = traits::ObligationCause::misc(impl_m_span, impl_m_node_id);
- let trait_param_env = impl_param_env.with_caller_bounds(
- tcx.intern_predicates(&hybrid_preds.predicates));
- let trait_param_env = traits::normalize_param_env_or_error(tcx,
- impl_m.def_id,
- trait_param_env,
- normalize_cause.clone());
-
- tcx.infer_ctxt(trait_param_env, Reveal::UserFacing).enter(|infcx| {
+ let param_env = ty::ParamEnv::new(tcx.intern_predicates(&hybrid_preds.predicates),
+ Reveal::UserFacing);
+ let param_env = traits::normalize_param_env_or_error(tcx,
+ impl_m.def_id,
+ param_env,
+ normalize_cause.clone());
+
+ tcx.infer_ctxt(param_env).enter(|infcx| {
let inh = Inherited::new(infcx, impl_m.def_id);
let infcx = &inh.infcx;
debug!("compare_impl_method: caller_bounds={:?}",
- infcx.parameter_environment.caller_bounds);
+ infcx.param_env.caller_bounds);
let mut selcx = traits::SelectionContext::new(&infcx);
let region_maps = RegionMaps::new();
let mut free_regions = FreeRegionMap::new();
free_regions.relate_free_regions_from_predicates(
- &infcx.parameter_environment.caller_bounds);
+ &infcx.param_env.caller_bounds);
infcx.resolve_regions_and_report_errors(impl_m.def_id, ®ion_maps, &free_regions);
} else {
let fcx = FnCtxt::new(&inh, impl_m_node_id);
impl_trait_ref: ty::TraitRef<'tcx>) {
debug!("compare_const_impl(impl_trait_ref={:?})", impl_trait_ref);
- tcx.infer_ctxt((), Reveal::UserFacing).enter(|infcx| {
+ tcx.infer_ctxt(Reveal::UserFacing).enter(|infcx| {
let inh = Inherited::new(infcx, impl_c.def_id);
let infcx = &inh.infcx;
diag.emit();
}
- // FIXME(#41323) Check the obligations in the fulfillment context.
+ // Check that all obligations are satisfied by the implementation's
+ // version.
+ if let Err(ref errors) = inh.fulfillment_cx.borrow_mut().select_all_or_error(&infcx) {
+ infcx.report_fulfillment_errors(errors);
+ return;
+ }
+
+ let fcx = FnCtxt::new(&inh, impl_c_node_id);
+ fcx.regionck_item(impl_c_node_id, impl_c_span, &[]);
});
}