Skip to content

Commit abd3fe3

Browse files
ecstatic-morseMark-Simulacrum
authored andcommitted
Ignore errors re: unreachable blocks in dataflow cursor unit tests
1 parent aca8bcb commit abd3fe3

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

compiler/rustc_mir_dataflow/src/framework/cursor.rs

+7
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ where
6464
}
6565
}
6666

67+
/// Allows inspection of unreachable basic blocks even with `debug_assertions` enabled.
68+
#[cfg(test)]
69+
pub(crate) fn allow_unreachable(&mut self) {
70+
#[cfg(debug_assertions)]
71+
self.reachable_blocks.insert_all()
72+
}
73+
6774
/// Returns the underlying `Results`.
6875
pub fn results(&self) -> &Results<'tcx, A> {
6976
&self.results.borrow()

compiler/rustc_mir_dataflow/src/framework/tests.rs

+2
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,8 @@ fn test_cursor<D: Direction>(analysis: MockAnalysis<'tcx, D>) {
268268
let mut cursor =
269269
Results { entry_sets: analysis.mock_entry_sets(), analysis }.into_results_cursor(body);
270270

271+
cursor.allow_unreachable();
272+
271273
let every_target = || {
272274
body.basic_blocks()
273275
.iter_enumerated()

0 commit comments

Comments
 (0)