@@ -25,7 +25,7 @@ use rustc_hir as hir;
25
25
use rustc_hir:: def_id:: LocalDefId ;
26
26
use rustc_index:: bit_set:: ChunkedBitSet ;
27
27
use rustc_index:: vec:: IndexVec ;
28
- use rustc_infer:: infer:: { DefiningAnchor , InferCtxt , TyCtxtInferExt } ;
28
+ use rustc_infer:: infer:: { DefiningAnchor , InferCtxt , NllRegionVariableOrigin , TyCtxtInferExt } ;
29
29
use rustc_middle:: mir:: {
30
30
traversal, Body , ClearCrossCrate , Local , Location , Mutability , NonDivergingIntrinsic , Operand ,
31
31
Place , PlaceElem , PlaceRef , VarDebugInfoContents ,
@@ -43,6 +43,7 @@ use smallvec::SmallVec;
43
43
use std:: cell:: OnceCell ;
44
44
use std:: cell:: RefCell ;
45
45
use std:: collections:: BTreeMap ;
46
+ use std:: ops:: Deref ;
46
47
use std:: rc:: Rc ;
47
48
48
49
use rustc_mir_dataflow:: impls:: {
@@ -481,6 +482,33 @@ pub struct BodyWithBorrowckFacts<'tcx> {
481
482
pub location_table : LocationTable ,
482
483
}
483
484
485
+ struct BorrowckInferCtxt < ' cx , ' tcx > {
486
+ pub ( crate ) infcx : & ' cx InferCtxt < ' tcx > ,
487
+
488
+ #[ cfg( debug_assertions) ]
489
+ pub ( crate ) _reg_var_to_origin : RefCell < FxHashMap < ty:: Region < ' tcx > , NllRegionVariableOrigin > > ,
490
+ }
491
+
492
+ impl < ' cx , ' tcx > BorrowckInferCtxt < ' cx , ' tcx > {
493
+ #[ cfg( not( debug_assertions) ) ]
494
+ pub ( crate ) fn _new ( infcx : & ' cx InferCtxt < ' tcx > ) -> Self {
495
+ BorrowckInferCtxt { infcx }
496
+ }
497
+
498
+ #[ cfg( debug_assertions) ]
499
+ pub ( crate ) fn _new ( infcx : & ' cx InferCtxt < ' tcx > ) -> Self {
500
+ BorrowckInferCtxt { infcx, _reg_var_to_origin : RefCell :: new ( Default :: default ( ) ) }
501
+ }
502
+ }
503
+
504
+ impl < ' cx , ' tcx > Deref for BorrowckInferCtxt < ' cx , ' tcx > {
505
+ type Target = InferCtxt < ' tcx > ;
506
+
507
+ fn deref ( & self ) -> & ' cx Self :: Target {
508
+ self . infcx
509
+ }
510
+ }
511
+
484
512
struct MirBorrowckCtxt < ' cx , ' tcx > {
485
513
infcx : & ' cx InferCtxt < ' tcx > ,
486
514
param_env : ParamEnv < ' tcx > ,
0 commit comments