@@ -14,7 +14,7 @@ use rustc_middle::mir::{
1414 visit:: { MutatingUseContext , NonMutatingUseContext , PlaceContext , Visitor as _} ,
1515 Mutability ,
1616} ;
17- use rustc_middle:: ty:: { self , fold:: TypeVisitor , Ty } ;
17+ use rustc_middle:: ty:: { self , fold:: TypeVisitor , Ty , TyCtxt } ;
1818use rustc_mir:: dataflow:: { Analysis , AnalysisDomain , GenKill , GenKillAnalysis , ResultsCursor } ;
1919use rustc_session:: { declare_lint_pass, declare_tool_lint} ;
2020use rustc_span:: source_map:: { BytePos , Span } ;
@@ -576,7 +576,7 @@ impl<'a, 'tcx> mir::visit::Visitor<'tcx> for PossibleBorrowerVisitor<'a, 'tcx> {
576576 self . possible_borrower . add ( borrowed. local , lhs) ;
577577 } ,
578578 other => {
579- if ContainsRegion
579+ if ContainsRegion ( self . cx . tcx )
580580 . visit_ty ( place. ty ( & self . body . local_decls , self . cx . tcx ) . ty )
581581 . is_continue ( )
582582 {
@@ -625,7 +625,7 @@ impl<'a, 'tcx> mir::visit::Visitor<'tcx> for PossibleBorrowerVisitor<'a, 'tcx> {
625625 . flat_map ( HybridBitSet :: iter)
626626 . collect ( ) ;
627627
628- if ContainsRegion . visit_ty ( self . body . local_decls [ * dest] . ty ) . is_break ( ) {
628+ if ContainsRegion ( self . cx . tcx ) . visit_ty ( self . body . local_decls [ * dest] . ty ) . is_break ( ) {
629629 mutable_variables. push ( * dest) ;
630630 }
631631
@@ -701,12 +701,15 @@ impl<'a, 'tcx> mir::visit::Visitor<'tcx> for PossibleOriginVisitor<'a, 'tcx> {
701701 }
702702}
703703
704- struct ContainsRegion ;
704+ struct ContainsRegion < ' tcx > ( TyCtxt < ' tcx > ) ;
705705
706- impl TypeVisitor < ' _ > for ContainsRegion {
706+ impl < ' tcx > TypeVisitor < ' tcx > for ContainsRegion < ' tcx > {
707707 type BreakTy = ( ) ;
708+ fn tcx_for_anon_const_substs ( & self ) -> TyCtxt < ' tcx > {
709+ self . 0
710+ }
708711
709- fn visit_region ( & mut self , _: ty:: Region < ' _ > ) -> ControlFlow < Self :: BreakTy > {
712+ fn visit_region ( & mut self , _: ty:: Region < ' tcx > ) -> ControlFlow < Self :: BreakTy > {
710713 ControlFlow :: BREAK
711714 }
712715}
0 commit comments