Skip to content

Commit de3f8a1

Browse files
committed
Fix MSVC build
1 parent bf6b84b commit de3f8a1

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

compiler/rustc_codegen_ssa/src/mir/block.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1615,7 +1615,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
16151615
let cp_llbb = Bx::append_block(self.cx, self.llfn, "cp_terminate");
16161616

16171617
let mut cs_bx = Bx::build(self.cx, llbb);
1618-
let cs = cs_bx.catch_switch(None, None, &[llbb]);
1618+
let cs = cs_bx.catch_switch(None, None, &[cp_llbb]);
16191619

16201620
// The "null" here is actually a RTTI type descriptor for the
16211621
// C++ personality function, but `catch (...)` has no type so

compiler/rustc_codegen_ssa/src/mir/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,9 @@ pub fn codegen_mir<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
166166
let start_llbb = Bx::append_block(cx, llfn, "start");
167167
let mut start_bx = Bx::build(cx, start_llbb);
168168

169-
if mir.basic_blocks.iter().any(|bb| bb.is_cleanup) {
169+
if mir.basic_blocks.iter().any(|bb| {
170+
bb.is_cleanup || matches!(bb.terminator().unwind(), Some(mir::UnwindAction::Terminate))
171+
}) {
170172
start_bx.set_personality_fn(cx.eh_personality());
171173
}
172174

0 commit comments

Comments
 (0)