File tree 1 file changed +10
-4
lines changed
src/librustc_mir/dataflow/framework
1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -41,14 +41,20 @@ where
41
41
A : Analysis < ' tcx > ,
42
42
R : Borrow < Results < ' tcx , A > > ,
43
43
{
44
- /// Returns a new cursor for `results` that points to the entry of the `START_BLOCK `.
44
+ /// Returns a new cursor that can inspect `results `.
45
45
pub fn new ( body : & ' mir mir:: Body < ' tcx > , results : R ) -> Self {
46
+ let bits_per_block = results. borrow ( ) . entry_set_for_block ( mir:: START_BLOCK ) . domain_size ( ) ;
47
+
46
48
ResultsCursor {
47
49
body,
48
- pos : CursorPosition :: block_entry ( mir:: START_BLOCK ) ,
49
- state : results. borrow ( ) . entry_set_for_block ( mir:: START_BLOCK ) . clone ( ) ,
50
- state_needs_reset : false ,
51
50
results,
51
+
52
+ // Initialize to an empty `BitSet` and set `state_needs_reset` to tell the cursor that
53
+ // it needs to reset to block entry before the first seek. The cursor position is
54
+ // immaterial.
55
+ state_needs_reset : true ,
56
+ state : BitSet :: new_empty ( bits_per_block) ,
57
+ pos : CursorPosition :: block_entry ( mir:: START_BLOCK ) ,
52
58
}
53
59
}
54
60
You can’t perform that action at this time.
0 commit comments