@@ -14,7 +14,7 @@ use rustc_middle::mir::{
14
14
visit:: { MutatingUseContext , NonMutatingUseContext , PlaceContext , Visitor as _} ,
15
15
Mutability ,
16
16
} ;
17
- use rustc_middle:: ty:: { self , fold:: TypeVisitor , Ty } ;
17
+ use rustc_middle:: ty:: { self , fold:: TypeVisitor , Ty , TyCtxt } ;
18
18
use rustc_mir:: dataflow:: { Analysis , AnalysisDomain , GenKill , GenKillAnalysis , ResultsCursor } ;
19
19
use rustc_session:: { declare_lint_pass, declare_tool_lint} ;
20
20
use rustc_span:: source_map:: { BytePos , Span } ;
@@ -576,7 +576,7 @@ impl<'a, 'tcx> mir::visit::Visitor<'tcx> for PossibleBorrowerVisitor<'a, 'tcx> {
576
576
self . possible_borrower . add ( borrowed. local , lhs) ;
577
577
} ,
578
578
other => {
579
- if ContainsRegion
579
+ if ContainsRegion ( self . cx . tcx )
580
580
. visit_ty ( place. ty ( & self . body . local_decls , self . cx . tcx ) . ty )
581
581
. is_continue ( )
582
582
{
@@ -625,7 +625,7 @@ impl<'a, 'tcx> mir::visit::Visitor<'tcx> for PossibleBorrowerVisitor<'a, 'tcx> {
625
625
. flat_map ( HybridBitSet :: iter)
626
626
. collect ( ) ;
627
627
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 ( ) {
629
629
mutable_variables. push ( * dest) ;
630
630
}
631
631
@@ -701,12 +701,15 @@ impl<'a, 'tcx> mir::visit::Visitor<'tcx> for PossibleOriginVisitor<'a, 'tcx> {
701
701
}
702
702
}
703
703
704
- struct ContainsRegion ;
704
+ struct ContainsRegion < ' tcx > ( TyCtxt < ' tcx > ) ;
705
705
706
- impl TypeVisitor < ' _ > for ContainsRegion {
706
+ impl < ' tcx > TypeVisitor < ' tcx > for ContainsRegion < ' tcx > {
707
707
type BreakTy = ( ) ;
708
+ fn tcx_for_anon_const_substs ( & self ) -> TyCtxt < ' tcx > {
709
+ self . 0
710
+ }
708
711
709
- fn visit_region ( & mut self , _: ty:: Region < ' _ > ) -> ControlFlow < Self :: BreakTy > {
712
+ fn visit_region ( & mut self , _: ty:: Region < ' tcx > ) -> ControlFlow < Self :: BreakTy > {
710
713
ControlFlow :: BREAK
711
714
}
712
715
}
0 commit comments