@@ -4,6 +4,7 @@ use rustc::mir::{self, BasicBlock, Location};
4
4
use rustc:: ty;
5
5
use rustc_index:: bit_set:: BitSet ;
6
6
use rustc_index:: vec:: IndexVec ;
7
+ use rustc_span:: DUMMY_SP ;
7
8
8
9
use super :: * ;
9
10
use crate :: dataflow:: BottomValue ;
@@ -23,8 +24,7 @@ fn is_call_terminator_non_diverging(body: &mir::Body<'_>, loc: Location) -> bool
23
24
/// This is the `Body` that will be used by the `MockAnalysis` below. The shape of its CFG is not
24
25
/// important.
25
26
fn mock_body ( ) -> mir:: Body < ' static > {
26
- let span = syntax_pos:: DUMMY_SP ;
27
- let source_info = mir:: SourceInfo { scope : mir:: OUTERMOST_SOURCE_SCOPE , span } ;
27
+ let source_info = mir:: SourceInfo { scope : mir:: OUTERMOST_SOURCE_SCOPE , span : DUMMY_SP } ;
28
28
29
29
let mut blocks = IndexVec :: new ( ) ;
30
30
let mut block = |n, kind| {
@@ -97,14 +97,14 @@ impl MockAnalysis<'tcx> {
97
97
98
98
/// The entry set for each `BasicBlock` is the ID of that block offset by a fixed amount to
99
99
/// avoid colliding with the statement/terminator effects.
100
- fn mock_entry_set ( self , bb : BasicBlock ) -> BitSet < usize > {
101
- let mut ret = BitSet :: new_empty ( self . bits_per_block ( body) ) ;
100
+ fn mock_entry_set ( & self , bb : BasicBlock ) -> BitSet < usize > {
101
+ let mut ret = BitSet :: new_empty ( self . bits_per_block ( self . body ) ) ;
102
102
ret. insert ( Self :: BASIC_BLOCK_OFFSET + bb. index ( ) ) ;
103
103
ret
104
104
}
105
105
106
106
fn mock_entry_sets ( & self ) -> IndexVec < BasicBlock , BitSet < usize > > {
107
- let empty = BitSet :: new_empty ( self . bits_per_block ( body) ) ;
107
+ let empty = BitSet :: new_empty ( self . bits_per_block ( self . body ) ) ;
108
108
let mut ret = IndexVec :: from_elem ( empty, & self . body . basic_blocks ( ) ) ;
109
109
110
110
for ( bb, _) in self . body . basic_blocks ( ) . iter_enumerated ( ) {
@@ -183,7 +183,7 @@ impl Analysis<'tcx> for MockAnalysis<'tcx> {
183
183
_statement : & mir:: Statement < ' tcx > ,
184
184
location : Location ,
185
185
) {
186
- let idx = SeekTarget :: After ( location) . effect ( self . body ) . unwrap ( ) ;
186
+ let idx = self . effect_at_target ( SeekTarget :: After ( location) ) . unwrap ( ) ;
187
187
assert ! ( state. insert( idx) ) ;
188
188
}
189
189
@@ -193,7 +193,7 @@ impl Analysis<'tcx> for MockAnalysis<'tcx> {
193
193
_statement : & mir:: Statement < ' tcx > ,
194
194
location : Location ,
195
195
) {
196
- let idx = SeekTarget :: Before ( location) . effect ( self . body ) . unwrap ( ) ;
196
+ let idx = self . effect_at_target ( SeekTarget :: Before ( location) ) . unwrap ( ) ;
197
197
assert ! ( state. insert( idx) ) ;
198
198
}
199
199
@@ -203,7 +203,7 @@ impl Analysis<'tcx> for MockAnalysis<'tcx> {
203
203
_terminator : & mir:: Terminator < ' tcx > ,
204
204
location : Location ,
205
205
) {
206
- let idx = SeekTarget :: After ( location) . effect ( self . body ) . unwrap ( ) ;
206
+ let idx = self . effect_at_target ( SeekTarget :: After ( location) ) . unwrap ( ) ;
207
207
assert ! ( state. insert( idx) ) ;
208
208
}
209
209
@@ -213,7 +213,7 @@ impl Analysis<'tcx> for MockAnalysis<'tcx> {
213
213
_terminator : & mir:: Terminator < ' tcx > ,
214
214
location : Location ,
215
215
) {
216
- let idx = SeekTarget :: Before ( location) . effect ( self . body ) . unwrap ( ) ;
216
+ let idx = self . effect_at_target ( SeekTarget :: Before ( location) ) . unwrap ( ) ;
217
217
assert ! ( state. insert( idx) ) ;
218
218
}
219
219
@@ -226,7 +226,7 @@ impl Analysis<'tcx> for MockAnalysis<'tcx> {
226
226
_return_place : & mir:: Place < ' tcx > ,
227
227
) {
228
228
let location = self . body . terminator_loc ( block) ;
229
- let idx = SeekTarget :: AfterAssumeCallReturns ( location) . effect ( self . body ) . unwrap ( ) ;
229
+ let idx = self . effect_at_target ( SeekTarget :: AfterAssumeCallReturns ( location) ) . unwrap ( ) ;
230
230
assert ! ( state. insert( idx) ) ;
231
231
}
232
232
}
@@ -286,7 +286,10 @@ fn cursor_seek() {
286
286
. analysis ( )
287
287
. effect_at_target ( SeekTarget :: AfterAssumeCallReturns ( call_terminator_loc) )
288
288
. unwrap ( ) ;
289
- assert_ne ! ( call_return_effect, SeekTarget :: After ( call_terminator_loc) . effect( body) . unwrap( ) ) ;
289
+ assert_ne ! (
290
+ call_return_effect,
291
+ cursor. analysis( ) . effect_at_target( SeekTarget :: After ( call_terminator_loc) ) . unwrap( )
292
+ ) ;
290
293
291
294
cursor. seek_after ( call_terminator_loc) ;
292
295
assert ! ( !cursor. get( ) . contains( call_return_effect) ) ;
0 commit comments