Skip to content

Commit 1d28d6f

Browse files
committed
Factor out some more repetitive code.
1 parent 3dd0f5f commit 1d28d6f

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

compiler/rustc_mir_transform/src/coroutine.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,7 +1199,7 @@ fn insert_panic_block<'tcx>(
11991199
message: AssertMessage<'tcx>,
12001200
) -> BasicBlock {
12011201
let assert_block = BasicBlock::new(body.basic_blocks.len());
1202-
let term = TerminatorKind::Assert {
1202+
let kind = TerminatorKind::Assert {
12031203
cond: Operand::Constant(Box::new(ConstOperand {
12041204
span: body.span,
12051205
user_ty: None,
@@ -1211,14 +1211,7 @@ fn insert_panic_block<'tcx>(
12111211
unwind: UnwindAction::Continue,
12121212
};
12131213

1214-
let source_info = SourceInfo::outermost(body.span);
1215-
body.basic_blocks_mut().push(BasicBlockData {
1216-
statements: Vec::new(),
1217-
terminator: Some(Terminator { source_info, kind: term }),
1218-
is_cleanup: false,
1219-
});
1220-
1221-
assert_block
1214+
insert_term_block(body, kind)
12221215
}
12231216

12241217
fn can_return<'tcx>(tcx: TyCtxt<'tcx>, body: &Body<'tcx>, param_env: ty::ParamEnv<'tcx>) -> bool {

0 commit comments

Comments
 (0)