Skip to content

Commit 1006ad0

Browse files
Fix test
1 parent b70898d commit 1006ad0

File tree

1 file changed

+14
-11
lines changed
  • src/librustc_mir/dataflow/generic

1 file changed

+14
-11
lines changed

src/librustc_mir/dataflow/generic/tests.rs

+14-11
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use rustc::mir::{self, BasicBlock, Location};
44
use rustc::ty;
55
use rustc_index::bit_set::BitSet;
66
use rustc_index::vec::IndexVec;
7+
use rustc_span::DUMMY_SP;
78

89
use super::*;
910
use crate::dataflow::BottomValue;
@@ -23,8 +24,7 @@ fn is_call_terminator_non_diverging(body: &mir::Body<'_>, loc: Location) -> bool
2324
/// This is the `Body` that will be used by the `MockAnalysis` below. The shape of its CFG is not
2425
/// important.
2526
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 };
2828

2929
let mut blocks = IndexVec::new();
3030
let mut block = |n, kind| {
@@ -97,14 +97,14 @@ impl MockAnalysis<'tcx> {
9797

9898
/// The entry set for each `BasicBlock` is the ID of that block offset by a fixed amount to
9999
/// 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));
102102
ret.insert(Self::BASIC_BLOCK_OFFSET + bb.index());
103103
ret
104104
}
105105

106106
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));
108108
let mut ret = IndexVec::from_elem(empty, &self.body.basic_blocks());
109109

110110
for (bb, _) in self.body.basic_blocks().iter_enumerated() {
@@ -183,7 +183,7 @@ impl Analysis<'tcx> for MockAnalysis<'tcx> {
183183
_statement: &mir::Statement<'tcx>,
184184
location: Location,
185185
) {
186-
let idx = SeekTarget::After(location).effect(self.body).unwrap();
186+
let idx = self.effect_at_target(SeekTarget::After(location)).unwrap();
187187
assert!(state.insert(idx));
188188
}
189189

@@ -193,7 +193,7 @@ impl Analysis<'tcx> for MockAnalysis<'tcx> {
193193
_statement: &mir::Statement<'tcx>,
194194
location: Location,
195195
) {
196-
let idx = SeekTarget::Before(location).effect(self.body).unwrap();
196+
let idx = self.effect_at_target(SeekTarget::Before(location)).unwrap();
197197
assert!(state.insert(idx));
198198
}
199199

@@ -203,7 +203,7 @@ impl Analysis<'tcx> for MockAnalysis<'tcx> {
203203
_terminator: &mir::Terminator<'tcx>,
204204
location: Location,
205205
) {
206-
let idx = SeekTarget::After(location).effect(self.body).unwrap();
206+
let idx = self.effect_at_target(SeekTarget::After(location)).unwrap();
207207
assert!(state.insert(idx));
208208
}
209209

@@ -213,7 +213,7 @@ impl Analysis<'tcx> for MockAnalysis<'tcx> {
213213
_terminator: &mir::Terminator<'tcx>,
214214
location: Location,
215215
) {
216-
let idx = SeekTarget::Before(location).effect(self.body).unwrap();
216+
let idx = self.effect_at_target(SeekTarget::Before(location)).unwrap();
217217
assert!(state.insert(idx));
218218
}
219219

@@ -226,7 +226,7 @@ impl Analysis<'tcx> for MockAnalysis<'tcx> {
226226
_return_place: &mir::Place<'tcx>,
227227
) {
228228
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();
230230
assert!(state.insert(idx));
231231
}
232232
}
@@ -286,7 +286,10 @@ fn cursor_seek() {
286286
.analysis()
287287
.effect_at_target(SeekTarget::AfterAssumeCallReturns(call_terminator_loc))
288288
.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+
);
290293

291294
cursor.seek_after(call_terminator_loc);
292295
assert!(!cursor.get().contains(call_return_effect));

0 commit comments

Comments
 (0)