From 1e988f228d3bef3547fa711aaee3ba89e0340eaf Mon Sep 17 00:00:00 2001 From: Marijn Haverbeke Date: Mon, 26 Sep 2011 04:08:45 +0200 Subject: [PATCH] Don't call trans_bind_thunk in an unreachable context Closes #973 --- src/comp/middle/trans.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index e5190aaa635e..df5e2a5e80fa 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -3596,6 +3596,10 @@ fn trans_bind_1(cx: @block_ctxt, outgoing_fty: ty::t, bound_vals += [lv]; bound_tys += [ty::expr_ty(bcx_tcx(cx), e)]; } + if bcx.unreachable { + ret rslt(bcx, llvm::LLVMGetUndef( + T_ptr(type_of_or_i8(bcx, outgoing_fty)))); + } // Actually construct the closure let closure =