4242 A : Analysis < ' tcx > ,
4343{
4444 body : & ' mir mir:: Body < ' tcx > ,
45- analysis : SimpleCow < ' mir , A > ,
46- results : SimpleCow < ' mir , Results < A :: Domain > > ,
45+ results : SimpleCow < ' mir , Results < ' tcx , A > > ,
4746 state : A :: Domain ,
4847
4948 pos : CursorPosition ,
@@ -71,15 +70,10 @@ where
7170 self . body
7271 }
7372
74- fn new (
75- body : & ' mir mir:: Body < ' tcx > ,
76- analysis : SimpleCow < ' mir , A > ,
77- results : SimpleCow < ' mir , Results < A :: Domain > > ,
78- ) -> Self {
79- let bottom_value = analysis. bottom_value ( body) ;
73+ fn new ( body : & ' mir mir:: Body < ' tcx > , results : SimpleCow < ' mir , Results < ' tcx , A > > ) -> Self {
74+ let bottom_value = results. analysis . bottom_value ( body) ;
8075 ResultsCursor {
8176 body,
82- analysis,
8377 results,
8478
8579 // Initialize to the `bottom_value` and set `state_needs_reset` to tell the cursor that
@@ -95,21 +89,13 @@ where
9589 }
9690
9791 /// Returns a new cursor that takes ownership of and inspects analysis results.
98- pub fn new_owning (
99- body : & ' mir mir:: Body < ' tcx > ,
100- analysis : A ,
101- results : Results < A :: Domain > ,
102- ) -> Self {
103- Self :: new ( body, SimpleCow :: Owned ( analysis) , SimpleCow :: Owned ( results) )
92+ pub fn new_owning ( body : & ' mir mir:: Body < ' tcx > , results : Results < ' tcx , A > ) -> Self {
93+ Self :: new ( body, SimpleCow :: Owned ( results) )
10494 }
10595
10696 /// Returns a new cursor that borrows and inspects analysis results.
107- pub fn new_borrowing (
108- body : & ' mir mir:: Body < ' tcx > ,
109- analysis : & ' mir A ,
110- results : & ' mir Results < A :: Domain > ,
111- ) -> Self {
112- Self :: new ( body, SimpleCow :: Borrowed ( analysis) , SimpleCow :: Borrowed ( results) )
97+ pub fn new_borrowing ( body : & ' mir mir:: Body < ' tcx > , results : & ' mir Results < ' tcx , A > ) -> Self {
98+ Self :: new ( body, SimpleCow :: Borrowed ( results) )
11399 }
114100
115101 /// Allows inspection of unreachable basic blocks even with `debug_assertions` enabled.
@@ -121,7 +107,7 @@ where
121107
122108 /// Returns the `Analysis` used to generate the underlying `Results`.
123109 pub fn analysis ( & self ) -> & A {
124- & self . analysis
110+ & self . results . analysis
125111 }
126112
127113 /// Resets the cursor to hold the entry set for the given basic block.
@@ -133,7 +119,7 @@ where
133119 #[ cfg( debug_assertions) ]
134120 assert ! ( self . reachable_blocks. contains( block) ) ;
135121
136- self . state . clone_from ( & self . results [ block] ) ;
122+ self . state . clone_from ( & self . results . entry_states [ block] ) ;
137123 self . pos = CursorPosition :: block_entry ( block) ;
138124 self . state_needs_reset = false ;
139125 }
@@ -225,7 +211,7 @@ where
225211 let target_effect_index = effect. at_index ( target. statement_index ) ;
226212
227213 A :: Direction :: apply_effects_in_range (
228- & * self . analysis ,
214+ & self . results . analysis ,
229215 & mut self . state ,
230216 target. block ,
231217 block_data,
@@ -241,7 +227,7 @@ where
241227 /// This can be used, e.g., to apply the call return effect directly to the cursor without
242228 /// creating an extra copy of the dataflow state.
243229 pub fn apply_custom_effect ( & mut self , f : impl FnOnce ( & A , & mut A :: Domain ) ) {
244- f ( & self . analysis , & mut self . state ) ;
230+ f ( & self . results . analysis , & mut self . state ) ;
245231 self . state_needs_reset = true ;
246232 }
247233}
0 commit comments