pub parameter_environment: ty::ParameterEnvironment<'a, 'tcx>,
- pub fulfillment_cx: RefCell<traits::FulfillmentContext<'tcx>>,
-
// the set of predicates on which errors have been reported, to
// avoid reporting the same error twice.
pub reported_trait_errors: RefCell<FnvHashSet<traits::TraitErrorKey<'tcx>>>,
float_unification_table: RefCell::new(UnificationTable::new()),
region_vars: RegionVarBindings::new(tcx),
parameter_environment: param_env.unwrap_or(tcx.empty_parameter_environment()),
- fulfillment_cx: RefCell::new(traits::FulfillmentContext::new()),
reported_trait_errors: RefCell::new(FnvHashSet()),
normalize: false,
err_count_on_creation: tcx.sess.err_count()
result,
obligations);
- let mut fulfill_cx = infcx.fulfillment_cx.borrow_mut();
+ let mut fulfill_cx = traits::FulfillmentContext::new();
for obligation in obligations {
fulfill_cx.register_predicate_obligation(&infcx, obligation);
let ty = self.tcx.node_id_to_type(e.id);
let infcx = infer::new_infer_ctxt(self.tcx, &self.tcx.tables, None);
let cause = traits::ObligationCause::new(e.span, e.id, traits::SharedStatic);
- let mut fulfill_cx = infcx.fulfillment_cx.borrow_mut();
- fulfill_cx.register_builtin_bound(&infcx, ty, ty::BoundSync, cause);
- match fulfill_cx.select_all_or_error(&infcx) {
+ let mut fulfillment_cx = traits::FulfillmentContext::new();
+ fulfillment_cx.register_builtin_bound(&infcx, ty, ty::BoundSync, cause);
+ match fulfillment_cx.select_all_or_error(&infcx) {
Ok(()) => { },
Err(ref errors) => {
traits::report_fulfillment_errors(&infcx, errors);
// Currently, we use a fulfillment context to completely resolve
// all nested obligations. This is because they can inform the
// inference of the impl's type parameters.
- let mut fulfill_cx = infcx.fulfillment_cx.borrow_mut();
+ let mut fulfill_cx = traits::FulfillmentContext::new();
let vtable = selection.map(|predicate| {
fulfill_cx.register_predicate_obligation(&infcx, predicate);
});
let tcx = ccx.tcx();
let infcx = infer::normalizing_infer_ctxt(tcx, &tcx.tables);
let mut selcx = traits::SelectionContext::new(&infcx);
- let mut fulfill_cx = infcx.fulfillment_cx.borrow_mut();
+ let mut fulfill_cx = traits::FulfillmentContext::new();
let cause = traits::ObligationCause::dummy();
let traits::Normalized { value: predicates, obligations } =
traits::normalize(&mut selcx, cause.clone(), &predicates);
expected_vid: ty::TyVid)
-> (Option<ty::FnSig<'tcx>>, Option<ty::ClosureKind>)
{
- let fulfillment_cx = fcx.inh.infcx.fulfillment_cx.borrow();
+ let fulfillment_cx = fcx.inh.fulfillment_cx.borrow();
// Here `expected_ty` is known to be a type inference variable.
let expected_sig =
impl_trait_ref);
let mut infcx = infer::new_infer_ctxt(tcx, &tcx.tables, None);
- let mut fulfillment_cx = infcx.fulfillment_cx.borrow_mut();
+ let mut fulfillment_cx = traits::FulfillmentContext::new();
let trait_to_impl_substs = &impl_trait_ref.substs;
impl_trait_ref);
let infcx = infer::new_infer_ctxt(tcx, &tcx.tables, None);
- let mut fulfillment_cx = infcx.fulfillment_cx.borrow_mut();
+ let mut fulfillment_cx = traits::FulfillmentContext::new();
// The below is for the most part highly similar to the procedure
// for methods above. It is simpler in many respects, especially
let impl_param_env = ty::ParameterEnvironment::for_item(tcx, self_type_node_id);
let infcx = infer::new_infer_ctxt(tcx, &tcx.tables, Some(impl_param_env));
+ let mut fulfillment_cx = traits::FulfillmentContext::new();
let named_type = tcx.lookup_item_type(self_type_did).ty;
let named_type = named_type.subst(tcx, &infcx.parameter_environment.free_substs);
return Err(());
}
- if let Err(ref errors) = infcx.fulfillment_cx.borrow_mut().select_all_or_error(&infcx) {
+ if let Err(ref errors) = fulfillment_cx.select_all_or_error(&infcx) {
// this could be reached when we get lazy normalization
traits::report_fulfillment_errors(&infcx, errors);
return Err(());
infcx: infer::InferCtxt<'a, 'tcx>,
locals: RefCell<NodeMap<Ty<'tcx>>>,
+ fulfillment_cx: RefCell<traits::FulfillmentContext<'tcx>>,
+
tables: &'a RefCell<ty::Tables<'tcx>>,
// When we process a call like `c()` where `c` is a closure type,
Inherited {
infcx: infer::new_infer_ctxt(tcx, tables, Some(param_env)),
+ fulfillment_cx: RefCell::new(traits::FulfillmentContext::new()),
locals: RefCell::new(NodeMap()),
tables: tables,
deferred_call_resolutions: RefCell::new(DefIdMap()),
-> T
where T : TypeFoldable<'tcx>
{
- let mut fulfillment_cx = self.infcx.fulfillment_cx.borrow_mut();
assoc::normalize_associated_types_in(&self.infcx,
- &mut fulfillment_cx,
+ &mut self.fulfillment_cx.borrow_mut(),
span,
body_id,
value)
self.body_id,
traits::ObligationCauseCode::MiscObligation);
self.inh
- .infcx
.fulfillment_cx
.borrow_mut()
.normalize_projection_type(self.infcx(),
builtin_bound: ty::BuiltinBound,
cause: traits::ObligationCause<'tcx>)
{
- self.inh.infcx.fulfillment_cx.borrow_mut()
+ self.inh.fulfillment_cx.borrow_mut()
.register_builtin_bound(self.infcx(), ty, builtin_bound, cause);
}
{
debug!("register_predicate({:?})",
obligation);
- self.inh.infcx.fulfillment_cx
+ self.inh.fulfillment_cx
.borrow_mut()
.register_predicate_obligation(self.infcx(), obligation);
}
region: ty::Region,
cause: traits::ObligationCause<'tcx>)
{
- let mut fulfillment_cx = self.inh.infcx.fulfillment_cx.borrow_mut();
+ let mut fulfillment_cx = self.inh.fulfillment_cx.borrow_mut();
fulfillment_cx.register_region_obligation(ty, region, cause);
}
self.select_all_obligations_and_apply_defaults();
- let mut fulfillment_cx = self.inh.infcx.fulfillment_cx.borrow_mut();
+ let mut fulfillment_cx = self.inh.fulfillment_cx.borrow_mut();
match fulfillment_cx.select_all_or_error(self.infcx()) {
Ok(()) => { }
Err(errors) => { report_fulfillment_errors(self.infcx(), &errors); }
/// Select as many obligations as we can at present.
fn select_obligations_where_possible(&self) {
match
- self.inh.infcx.fulfillment_cx
+ self.inh.fulfillment_cx
.borrow_mut()
.select_where_possible(self.infcx())
{
let region_obligations =
self.fcx
.inh
- .infcx
.fulfillment_cx
.borrow()
.region_obligations(node_id)
// Processing the region obligations should not cause the list to grow further:
assert_eq!(region_obligations.len(),
- self.fcx.inh.infcx.fulfillment_cx.borrow().region_obligations(node_id).len());
+ self.fcx.inh.fulfillment_cx.borrow().region_obligations(node_id).len());
}
fn code_to_origin(&self,
}
};
- let mut fulfill_cx = infcx.fulfillment_cx.borrow_mut();
+ let mut fulfill_cx = traits::FulfillmentContext::new();
// Register an obligation for `A: Trait<B>`.
let cause = traits::ObligationCause::misc(span, impl_node_id);