Skip to content

Commit a7bdce3

Browse files
committed
Move switch_sources from Body to BasicBlocks
1 parent d32e13e commit a7bdce3

File tree

2 files changed

+1
-9
lines changed

2 files changed

+1
-9
lines changed

Diff for: compiler/rustc_middle/src/mir/mod.rs

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

4343
pub use self::query::*;
44-
use self::switch_sources::SwitchSources;
4544
pub use basic_blocks::BasicBlocks;
4645

4746
mod basic_blocks;
@@ -446,13 +445,6 @@ impl<'tcx> Body<'tcx> {
446445
.unwrap_or_else(|| Either::Right(block_data.terminator()))
447446
}
448447

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

Diff for: 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)