1- use super :: * ;
2-
3- use crate :: { AnalysisDomain , CallReturnPlaces , GenKill , GenKillAnalysis } ;
1+ use rustc_index:: bit_set:: BitSet ;
42use rustc_middle:: mir:: visit:: Visitor ;
53use rustc_middle:: mir:: * ;
64
5+ use crate :: framework:: CallReturnPlaces ;
6+ use crate :: { AnalysisDomain , GenKill , GenKillAnalysis } ;
7+
78/// A dataflow analysis that tracks whether a pointer or reference could possibly exist that points
89/// to a given local.
910///
@@ -23,12 +24,12 @@ impl<'tcx> AnalysisDomain<'tcx> for MaybeBorrowedLocals {
2324 type Domain = BitSet < Local > ;
2425 const NAME : & ' static str = "maybe_borrowed_locals" ;
2526
26- fn bottom_value ( & self , body : & mir :: Body < ' tcx > ) -> Self :: Domain {
27+ fn bottom_value ( & self , body : & Body < ' tcx > ) -> Self :: Domain {
2728 // bottom = unborrowed
2829 BitSet :: new_empty ( body. local_decls ( ) . len ( ) )
2930 }
3031
31- fn initialize_start_block ( & self , _: & mir :: Body < ' tcx > , _: & mut Self :: Domain ) {
32+ fn initialize_start_block ( & self , _: & Body < ' tcx > , _: & mut Self :: Domain ) {
3233 // No locals are aliased on function entry
3334 }
3435}
@@ -39,7 +40,7 @@ impl<'tcx> GenKillAnalysis<'tcx> for MaybeBorrowedLocals {
3940 fn statement_effect (
4041 & mut self ,
4142 trans : & mut impl GenKill < Self :: Idx > ,
42- statement : & mir :: Statement < ' tcx > ,
43+ statement : & Statement < ' tcx > ,
4344 location : Location ,
4445 ) {
4546 self . transfer_function ( trans) . visit_statement ( statement, location) ;
@@ -48,7 +49,7 @@ impl<'tcx> GenKillAnalysis<'tcx> for MaybeBorrowedLocals {
4849 fn terminator_effect (
4950 & mut self ,
5051 trans : & mut impl GenKill < Self :: Idx > ,
51- terminator : & mir :: Terminator < ' tcx > ,
52+ terminator : & Terminator < ' tcx > ,
5253 location : Location ,
5354 ) {
5455 self . transfer_function ( trans) . visit_terminator ( terminator, location) ;
@@ -57,7 +58,7 @@ impl<'tcx> GenKillAnalysis<'tcx> for MaybeBorrowedLocals {
5758 fn call_return_effect (
5859 & mut self ,
5960 _trans : & mut impl GenKill < Self :: Idx > ,
60- _block : mir :: BasicBlock ,
61+ _block : BasicBlock ,
6162 _return_places : CallReturnPlaces < ' _ , ' tcx > ,
6263 ) {
6364 }
@@ -82,37 +83,37 @@ where
8283 }
8384 }
8485
85- fn visit_rvalue ( & mut self , rvalue : & mir :: Rvalue < ' tcx > , location : Location ) {
86+ fn visit_rvalue ( & mut self , rvalue : & Rvalue < ' tcx > , location : Location ) {
8687 self . super_rvalue ( rvalue, location) ;
8788
8889 match rvalue {
89- mir :: Rvalue :: AddressOf ( _, borrowed_place) | mir :: Rvalue :: Ref ( _, _, borrowed_place) => {
90+ Rvalue :: AddressOf ( _, borrowed_place) | Rvalue :: Ref ( _, _, borrowed_place) => {
9091 if !borrowed_place. is_indirect ( ) {
9192 self . trans . gen ( borrowed_place. local ) ;
9293 }
9394 }
9495
95- mir :: Rvalue :: Cast ( ..)
96- | mir :: Rvalue :: ShallowInitBox ( ..)
97- | mir :: Rvalue :: Use ( ..)
98- | mir :: Rvalue :: ThreadLocalRef ( ..)
99- | mir :: Rvalue :: Repeat ( ..)
100- | mir :: Rvalue :: Len ( ..)
101- | mir :: Rvalue :: BinaryOp ( ..)
102- | mir :: Rvalue :: CheckedBinaryOp ( ..)
103- | mir :: Rvalue :: NullaryOp ( ..)
104- | mir :: Rvalue :: UnaryOp ( ..)
105- | mir :: Rvalue :: Discriminant ( ..)
106- | mir :: Rvalue :: Aggregate ( ..)
107- | mir :: Rvalue :: CopyForDeref ( ..) => { }
96+ Rvalue :: Cast ( ..)
97+ | Rvalue :: ShallowInitBox ( ..)
98+ | Rvalue :: Use ( ..)
99+ | Rvalue :: ThreadLocalRef ( ..)
100+ | Rvalue :: Repeat ( ..)
101+ | Rvalue :: Len ( ..)
102+ | Rvalue :: BinaryOp ( ..)
103+ | Rvalue :: CheckedBinaryOp ( ..)
104+ | Rvalue :: NullaryOp ( ..)
105+ | Rvalue :: UnaryOp ( ..)
106+ | Rvalue :: Discriminant ( ..)
107+ | Rvalue :: Aggregate ( ..)
108+ | Rvalue :: CopyForDeref ( ..) => { }
108109 }
109110 }
110111
111- fn visit_terminator ( & mut self , terminator : & mir :: Terminator < ' tcx > , location : Location ) {
112+ fn visit_terminator ( & mut self , terminator : & Terminator < ' tcx > , location : Location ) {
112113 self . super_terminator ( terminator, location) ;
113114
114115 match terminator. kind {
115- mir :: TerminatorKind :: Drop { place : dropped_place, .. } => {
116+ TerminatorKind :: Drop { place : dropped_place, .. } => {
116117 // Drop terminators may call custom drop glue (`Drop::drop`), which takes `&mut
117118 // self` as a parameter. In the general case, a drop impl could launder that
118119 // reference into the surrounding environment through a raw pointer, thus creating
0 commit comments