@@ -161,6 +161,8 @@ pub struct Inherited<'a, 'tcx: 'a> {
161
161
infcx : infer:: InferCtxt < ' a , ' tcx > ,
162
162
locals : RefCell < NodeMap < Ty < ' tcx > > > ,
163
163
164
+ fulfillment_cx : RefCell < traits:: FulfillmentContext < ' tcx > > ,
165
+
164
166
tables : & ' a RefCell < ty:: Tables < ' tcx > > ,
165
167
166
168
// When we process a call like `c()` where `c` is a closure type,
@@ -306,6 +308,7 @@ impl<'a, 'tcx> Inherited<'a, 'tcx> {
306
308
307
309
Inherited {
308
310
infcx : infer:: new_infer_ctxt ( tcx, tables, Some ( param_env) ) ,
311
+ fulfillment_cx : RefCell :: new ( traits:: FulfillmentContext :: new ( ) ) ,
309
312
locals : RefCell :: new ( NodeMap ( ) ) ,
310
313
tables : tables,
311
314
deferred_call_resolutions : RefCell :: new ( DefIdMap ( ) ) ,
@@ -320,9 +323,8 @@ impl<'a, 'tcx> Inherited<'a, 'tcx> {
320
323
-> T
321
324
where T : TypeFoldable < ' tcx >
322
325
{
323
- let mut fulfillment_cx = self . infcx . fulfillment_cx . borrow_mut ( ) ;
324
326
assoc:: normalize_associated_types_in ( & self . infcx ,
325
- & mut fulfillment_cx,
327
+ & mut self . fulfillment_cx . borrow_mut ( ) ,
326
328
span,
327
329
body_id,
328
330
value)
@@ -1370,7 +1372,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
1370
1372
self . body_id ,
1371
1373
traits:: ObligationCauseCode :: MiscObligation ) ;
1372
1374
self . inh
1373
- . infcx
1374
1375
. fulfillment_cx
1375
1376
. borrow_mut ( )
1376
1377
. normalize_projection_type ( self . infcx ( ) ,
@@ -1505,7 +1506,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
1505
1506
builtin_bound : ty:: BuiltinBound ,
1506
1507
cause : traits:: ObligationCause < ' tcx > )
1507
1508
{
1508
- self . inh . infcx . fulfillment_cx . borrow_mut ( )
1509
+ self . inh . fulfillment_cx . borrow_mut ( )
1509
1510
. register_builtin_bound ( self . infcx ( ) , ty, builtin_bound, cause) ;
1510
1511
}
1511
1512
@@ -1514,7 +1515,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
1514
1515
{
1515
1516
debug ! ( "register_predicate({:?})" ,
1516
1517
obligation) ;
1517
- self . inh . infcx . fulfillment_cx
1518
+ self . inh . fulfillment_cx
1518
1519
. borrow_mut ( )
1519
1520
. register_predicate_obligation ( self . infcx ( ) , obligation) ;
1520
1521
}
@@ -1646,7 +1647,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
1646
1647
region : ty:: Region ,
1647
1648
cause : traits:: ObligationCause < ' tcx > )
1648
1649
{
1649
- let mut fulfillment_cx = self . inh . infcx . fulfillment_cx . borrow_mut ( ) ;
1650
+ let mut fulfillment_cx = self . inh . fulfillment_cx . borrow_mut ( ) ;
1650
1651
fulfillment_cx. register_region_obligation ( ty, region, cause) ;
1651
1652
}
1652
1653
@@ -2003,7 +2004,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
2003
2004
2004
2005
self . select_all_obligations_and_apply_defaults ( ) ;
2005
2006
2006
- let mut fulfillment_cx = self . inh . infcx . fulfillment_cx . borrow_mut ( ) ;
2007
+ let mut fulfillment_cx = self . inh . fulfillment_cx . borrow_mut ( ) ;
2007
2008
match fulfillment_cx. select_all_or_error ( self . infcx ( ) ) {
2008
2009
Ok ( ( ) ) => { }
2009
2010
Err ( errors) => { report_fulfillment_errors ( self . infcx ( ) , & errors) ; }
@@ -2013,7 +2014,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
2013
2014
/// Select as many obligations as we can at present.
2014
2015
fn select_obligations_where_possible ( & self ) {
2015
2016
match
2016
- self . inh . infcx . fulfillment_cx
2017
+ self . inh . fulfillment_cx
2017
2018
. borrow_mut ( )
2018
2019
. select_where_possible ( self . infcx ( ) )
2019
2020
{
0 commit comments