-use rustc::ty::TyCtxt;
+use crate::transform::{MirPass, MirSource};
use rustc::mir::*;
+use rustc::ty::TyCtxt;
use rustc_index::vec::{Idx, IndexVec};
-use crate::transform::{MirPass, MirSource};
#[derive(PartialEq)]
pub enum AddCallGuards {
*/
impl<'tcx> MirPass<'tcx> for AddCallGuards {
- fn run_pass(
- &self, _tcx: TyCtxt<'tcx>, _src: MirSource<'tcx>, body: &mut BodyAndCache<'tcx>
- ) {
+ fn run_pass(&self, _tcx: TyCtxt<'tcx>, _src: MirSource<'tcx>, body: &mut BodyAndCache<'tcx>) {
self.add_call_guards(body);
}
}
for block in body.basic_blocks_mut() {
match block.terminator {
Some(Terminator {
- kind: TerminatorKind::Call {
- destination: Some((_, ref mut destination)),
- cleanup,
- ..
- }, source_info
- }) if pred_count[*destination] > 1 &&
- (cleanup.is_some() || self == &AllCallEdges) =>
+ kind:
+ TerminatorKind::Call {
+ destination: Some((_, ref mut destination)),
+ cleanup,
+ ..
+ },
+ source_info,
+ }) if pred_count[*destination] > 1
+ && (cleanup.is_some() || self == &AllCallEdges) =>
{
// It's a critical edge, break it
let call_guard = BasicBlockData {
is_cleanup: block.is_cleanup,
terminator: Some(Terminator {
source_info,
- kind: TerminatorKind::Goto { target: *destination }
- })
+ kind: TerminatorKind::Goto { target: *destination },
+ }),
};
// Get the index it will be when inserted into the MIR