diff options
| author | Dylan MacKenzie <ecstaticmorse@gmail.com> | 2021-10-22 15:47:36 -0700 |
|---|---|---|
| committer | Mark Rousskov <mark.simulacrum@gmail.com> | 2021-10-23 21:55:57 -0400 |
| commit | abd3fe347b41328b556c333330bbc815b5ec99e5 (patch) | |
| tree | 8d27d8af587bc2bbe869c49f6f405f57b166773e | |
| parent | aca8bcb48feca8c87b9af4e440835992d3f6d470 (diff) | |
| download | rust-abd3fe347b41328b556c333330bbc815b5ec99e5.tar.gz rust-abd3fe347b41328b556c333330bbc815b5ec99e5.zip | |
Ignore errors re: unreachable blocks in dataflow cursor unit tests
| -rw-r--r-- | compiler/rustc_mir_dataflow/src/framework/cursor.rs | 7 | ||||
| -rw-r--r-- | compiler/rustc_mir_dataflow/src/framework/tests.rs | 2 |
2 files changed, 9 insertions, 0 deletions
diff --git a/compiler/rustc_mir_dataflow/src/framework/cursor.rs b/compiler/rustc_mir_dataflow/src/framework/cursor.rs index c000e49c14b..ba6b566a304 100644 --- a/compiler/rustc_mir_dataflow/src/framework/cursor.rs +++ b/compiler/rustc_mir_dataflow/src/framework/cursor.rs @@ -64,6 +64,13 @@ where } } + /// Allows inspection of unreachable basic blocks even with `debug_assertions` enabled. + #[cfg(test)] + pub(crate) fn allow_unreachable(&mut self) { + #[cfg(debug_assertions)] + self.reachable_blocks.insert_all() + } + /// Returns the underlying `Results`. pub fn results(&self) -> &Results<'tcx, A> { &self.results.borrow() diff --git a/compiler/rustc_mir_dataflow/src/framework/tests.rs b/compiler/rustc_mir_dataflow/src/framework/tests.rs index a5989121679..6efa8daec48 100644 --- a/compiler/rustc_mir_dataflow/src/framework/tests.rs +++ b/compiler/rustc_mir_dataflow/src/framework/tests.rs @@ -268,6 +268,8 @@ fn test_cursor<D: Direction>(analysis: MockAnalysis<'tcx, D>) { let mut cursor = Results { entry_sets: analysis.mock_entry_sets(), analysis }.into_results_cursor(body); + cursor.allow_unreachable(); + let every_target = || { body.basic_blocks() .iter_enumerated() |
