/// Normalizes the parameter environment, reporting errors if they occur.
pub fn normalize_param_env_or_error<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
region_context: DefId,
- unnormalized_env: ty::ParameterEnvironment<'tcx>,
+ unnormalized_env: ty::ParamEnv<'tcx>,
cause: ObligationCause<'tcx>)
- -> ty::ParameterEnvironment<'tcx>
+ -> ty::ParamEnv<'tcx>
{
// I'm not wild about reporting errors here; I'd prefer to
// have the errors get reported at a defined place (e.g.,
debug!("normalize_param_env_or_error: elaborated-predicates={:?}",
predicates);
- let elaborated_env = unnormalized_env.with_caller_bounds(tcx.intern_predicates(&predicates));
+ let elaborated_env = ty::ParamEnv::new(tcx.intern_predicates(&predicates),
+ unnormalized_env.reveal);
- tcx.infer_ctxt(elaborated_env, Reveal::UserFacing).enter(|infcx| {
+ tcx.infer_ctxt(elaborated_env).enter(|infcx| {
let predicates = match fully_normalize(
&infcx, cause,
- // You would really want to pass infcx.parameter_environment.caller_bounds here,
+ // You would really want to pass infcx.param_env.caller_bounds here,
// but that is an interned slice, and fully_normalize takes &T and returns T, so
// without further refactoring, a slice can't be used. Luckily, we still have the
- // predicate vector from which we created the ParameterEnvironment in infcx, so we
+ // predicate vector from which we created the ParamEnv in infcx, so we
// can pass that instead. It's roundabout and a bit brittle, but this code path
// ought to be refactored anyway, and until then it saves us from having to copy.
&predicates,
Err(errors) => {
infcx.report_fulfillment_errors(&errors);
// An unnormalized env is better than nothing.
- return infcx.parameter_environment;
+ return infcx.param_env;
}
};
// all things considered.
tcx.sess.span_err(span, &fixup_err.to_string());
// An unnormalized env is better than nothing.
- return infcx.parameter_environment;
+ return infcx.param_env;
}
};
let predicates = match tcx.lift_to_global(&predicates) {
Some(predicates) => predicates,
- None => return infcx.parameter_environment
+ None => return infcx.param_env
};
debug!("normalize_param_env_or_error: resolved predicates={:?}",
predicates);
- infcx.parameter_environment.with_caller_bounds(tcx.intern_predicates(&predicates))
+ ty::ParamEnv::new(tcx.intern_predicates(&predicates), unnormalized_env.reveal)
})
}
debug!("normalize_and_test_predicates(predicates={:?})",
predicates);
- tcx.infer_ctxt((), Reveal::All).enter(|infcx| {
+ tcx.infer_ctxt(Reveal::All).enter(|infcx| {
let mut selcx = SelectionContext::new(&infcx);
let mut fulfill_cx = FulfillmentContext::new();
let cause = ObligationCause::dummy();
debug!("get_vtable_methods({:?})", trait_ref);
supertraits(tcx, trait_ref).flat_map(move |trait_ref| {
- tcx.populate_implementations_for_trait_if_necessary(trait_ref.def_id());
-
let trait_methods = tcx.associated_items(trait_ref.def_id())
.filter(|item| item.kind == ty::AssociatedKind::Method);
ty::Binder(self.predicate.skip_binder().self_ty())
}
}
+
+pub fn provide(providers: &mut ty::maps::Providers) {
+ *providers = ty::maps::Providers {
+ is_object_safe: object_safety::is_object_safe_provider,
+ specialization_graph_of: specialize::specialization_graph_provider,
+ ..*providers
+ };
+}
+
+pub fn provide_extern(providers: &mut ty::maps::Providers) {
+ *providers = ty::maps::Providers {
+ is_object_safe: object_safety::is_object_safe_provider,
+ specialization_graph_of: specialize::specialization_graph_provider,
+ ..*providers
+ };
+}