@@ -161,6 +161,8 @@ pub struct Inherited<'a, 'tcx: 'a> {
161161 infcx : infer:: InferCtxt < ' a , ' tcx > ,
162162 locals : RefCell < NodeMap < Ty < ' tcx > > > ,
163163
164+ fulfillment_cx : RefCell < traits:: FulfillmentContext < ' tcx > > ,
165+
164166 tables : & ' a RefCell < ty:: Tables < ' tcx > > ,
165167
166168 // When we process a call like `c()` where `c` is a closure type,
@@ -306,6 +308,7 @@ impl<'a, 'tcx> Inherited<'a, 'tcx> {
306308
307309 Inherited {
308310 infcx : infer:: new_infer_ctxt ( tcx, tables, Some ( param_env) ) ,
311+ fulfillment_cx : RefCell :: new ( traits:: FulfillmentContext :: new ( ) ) ,
309312 locals : RefCell :: new ( NodeMap ( ) ) ,
310313 tables : tables,
311314 deferred_call_resolutions : RefCell :: new ( DefIdMap ( ) ) ,
@@ -320,9 +323,8 @@ impl<'a, 'tcx> Inherited<'a, 'tcx> {
320323 -> T
321324 where T : TypeFoldable < ' tcx >
322325 {
323- let mut fulfillment_cx = self . infcx . fulfillment_cx . borrow_mut ( ) ;
324326 assoc:: normalize_associated_types_in ( & self . infcx ,
325- & mut fulfillment_cx,
327+ & mut self . fulfillment_cx . borrow_mut ( ) ,
326328 span,
327329 body_id,
328330 value)
@@ -1370,7 +1372,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
13701372 self . body_id ,
13711373 traits:: ObligationCauseCode :: MiscObligation ) ;
13721374 self . inh
1373- . infcx
13741375 . fulfillment_cx
13751376 . borrow_mut ( )
13761377 . normalize_projection_type ( self . infcx ( ) ,
@@ -1505,7 +1506,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
15051506 builtin_bound : ty:: BuiltinBound ,
15061507 cause : traits:: ObligationCause < ' tcx > )
15071508 {
1508- self . inh . infcx . fulfillment_cx . borrow_mut ( )
1509+ self . inh . fulfillment_cx . borrow_mut ( )
15091510 . register_builtin_bound ( self . infcx ( ) , ty, builtin_bound, cause) ;
15101511 }
15111512
@@ -1514,7 +1515,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
15141515 {
15151516 debug ! ( "register_predicate({:?})" ,
15161517 obligation) ;
1517- self . inh . infcx . fulfillment_cx
1518+ self . inh . fulfillment_cx
15181519 . borrow_mut ( )
15191520 . register_predicate_obligation ( self . infcx ( ) , obligation) ;
15201521 }
@@ -1646,7 +1647,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
16461647 region : ty:: Region ,
16471648 cause : traits:: ObligationCause < ' tcx > )
16481649 {
1649- let mut fulfillment_cx = self . inh . infcx . fulfillment_cx . borrow_mut ( ) ;
1650+ let mut fulfillment_cx = self . inh . fulfillment_cx . borrow_mut ( ) ;
16501651 fulfillment_cx. register_region_obligation ( ty, region, cause) ;
16511652 }
16521653
@@ -2003,7 +2004,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
20032004
20042005 self . select_all_obligations_and_apply_defaults ( ) ;
20052006
2006- let mut fulfillment_cx = self . inh . infcx . fulfillment_cx . borrow_mut ( ) ;
2007+ let mut fulfillment_cx = self . inh . fulfillment_cx . borrow_mut ( ) ;
20072008 match fulfillment_cx. select_all_or_error ( self . infcx ( ) ) {
20082009 Ok ( ( ) ) => { }
20092010 Err ( errors) => { report_fulfillment_errors ( self . infcx ( ) , & errors) ; }
@@ -2013,7 +2014,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
20132014 /// Select as many obligations as we can at present.
20142015 fn select_obligations_where_possible ( & self ) {
20152016 match
2016- self . inh . infcx . fulfillment_cx
2017+ self . inh . fulfillment_cx
20172018 . borrow_mut ( )
20182019 . select_where_possible ( self . infcx ( ) )
20192020 {
0 commit comments