mir: Use the new method for BasicBlockData

This commit is contained in:
dianqk
2025-06-16 22:31:25 +08:00
parent 9f9cd5e283
commit 24e553e6bc
13 changed files with 180 additions and 209 deletions

View File

@@ -44,11 +44,10 @@ impl<'tcx> crate::MirPass<'tcx> for AddCallGuards {
let cur_len = body.basic_blocks.len();
let mut new_block = |source_info: SourceInfo, is_cleanup: bool, target: BasicBlock| {
let block = BasicBlockData {
statements: vec![],
let block = BasicBlockData::new(
Some(Terminator { source_info, kind: TerminatorKind::Goto { target } }),
is_cleanup,
terminator: Some(Terminator { source_info, kind: TerminatorKind::Goto { target } }),
};
);
let idx = cur_len + new_blocks.len();
new_blocks.push(block);
BasicBlock::new(idx)