Factor out some more repetitive code.
This commit is contained in:
parent
6af470e360
commit
cd9fd274d1
1 changed files with 2 additions and 9 deletions
|
@ -1199,7 +1199,7 @@ fn insert_panic_block<'tcx>(
|
||||||
message: AssertMessage<'tcx>,
|
message: AssertMessage<'tcx>,
|
||||||
) -> BasicBlock {
|
) -> BasicBlock {
|
||||||
let assert_block = BasicBlock::new(body.basic_blocks.len());
|
let assert_block = BasicBlock::new(body.basic_blocks.len());
|
||||||
let term = TerminatorKind::Assert {
|
let kind = TerminatorKind::Assert {
|
||||||
cond: Operand::Constant(Box::new(ConstOperand {
|
cond: Operand::Constant(Box::new(ConstOperand {
|
||||||
span: body.span,
|
span: body.span,
|
||||||
user_ty: None,
|
user_ty: None,
|
||||||
|
@ -1211,14 +1211,7 @@ fn insert_panic_block<'tcx>(
|
||||||
unwind: UnwindAction::Continue,
|
unwind: UnwindAction::Continue,
|
||||||
};
|
};
|
||||||
|
|
||||||
let source_info = SourceInfo::outermost(body.span);
|
insert_term_block(body, kind)
|
||||||
body.basic_blocks_mut().push(BasicBlockData {
|
|
||||||
statements: Vec::new(),
|
|
||||||
terminator: Some(Terminator { source_info, kind: term }),
|
|
||||||
is_cleanup: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
assert_block
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn can_return<'tcx>(tcx: TyCtxt<'tcx>, body: &Body<'tcx>, param_env: ty::ParamEnv<'tcx>) -> bool {
|
fn can_return<'tcx>(tcx: TyCtxt<'tcx>, body: &Body<'tcx>, param_env: ty::ParamEnv<'tcx>) -> bool {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue