@@ -25,7 +25,7 @@ use rustc_hir as hir;
2525use rustc_hir:: def_id:: LocalDefId ;
2626use rustc_index:: bit_set:: ChunkedBitSet ;
2727use rustc_index:: vec:: IndexVec ;
28- use rustc_infer:: infer:: { DefiningAnchor , InferCtxt , TyCtxtInferExt } ;
28+ use rustc_infer:: infer:: { DefiningAnchor , InferCtxt , NllRegionVariableOrigin , TyCtxtInferExt } ;
2929use rustc_middle:: mir:: {
3030 traversal, Body , ClearCrossCrate , Local , Location , Mutability , NonDivergingIntrinsic , Operand ,
3131 Place , PlaceElem , PlaceRef , VarDebugInfoContents ,
@@ -43,6 +43,7 @@ use smallvec::SmallVec;
4343use std:: cell:: OnceCell ;
4444use std:: cell:: RefCell ;
4545use std:: collections:: BTreeMap ;
46+ use std:: ops:: Deref ;
4647use std:: rc:: Rc ;
4748
4849use rustc_mir_dataflow:: impls:: {
@@ -481,6 +482,33 @@ pub struct BodyWithBorrowckFacts<'tcx> {
481482 pub location_table : LocationTable ,
482483}
483484
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+
484512struct MirBorrowckCtxt < ' cx , ' tcx > {
485513 infcx : & ' cx InferCtxt < ' tcx > ,
486514 param_env : ParamEnv < ' tcx > ,
0 commit comments