Skip to content

Commit dfa6a7c

Browse files
committed
Move switch_sources from Body to BasicBlocks
1 parent 39d9c1c commit dfa6a7c

File tree

2 files changed

+1
-9
lines changed

2 files changed

+1
-9
lines changed

compiler/rustc_middle/src/mir/mod.rs

-8
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ use std::ops::{ControlFlow, Index, IndexMut};
4242
use std::{iter, mem};
4343

4444
pub use self::query::*;
45-
use self::switch_sources::SwitchSources;
4645
pub use basic_blocks::BasicBlocks;
4746

4847
mod basic_blocks;
@@ -448,13 +447,6 @@ impl<'tcx> Body<'tcx> {
448447
.unwrap_or_else(|| Either::Right(block_data.terminator()))
449448
}
450449

451-
/// `body.switch_sources()[&(target, switch)]` returns a list of switch
452-
/// values that lead to a `target` block from a `switch` block.
453-
#[inline]
454-
pub fn switch_sources(&self) -> &SwitchSources {
455-
self.basic_blocks.switch_sources()
456-
}
457-
458450
#[inline]
459451
pub fn dominators(&self) -> Dominators<BasicBlock> {
460452
dominators(&self.basic_blocks)

compiler/rustc_mir_dataflow/src/framework/direction.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ where
316316
fn apply(&mut self, mut apply_edge_effect: impl FnMut(&mut D, SwitchIntTarget)) {
317317
assert!(!self.effects_applied);
318318

319-
let values = &self.body.switch_sources()[&(self.bb, self.pred)];
319+
let values = &self.body.basic_blocks.switch_sources()[&(self.bb, self.pred)];
320320
let targets = values.iter().map(|&value| SwitchIntTarget { value, target: self.bb });
321321

322322
let mut tmp = None;

0 commit comments

Comments
 (0)