From 6d0cb70fc36f444c07372ae58d641a6d8483cc95 Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Sun, 3 Jul 2011 10:39:07 -0700 Subject: [PATCH] Handle fail as an argument --- src/comp/middle/trans.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index b6897328c21..f0c66803d58 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -5610,6 +5610,14 @@ fn trans_args(&@block_ctxt cx, ValueRef llenv, &option::t[ValueRef] llobj, let @block_ctxt bcx = cx; // Arg 0: Output pointer. + // FIXME: test case looks like + // f(1, fail, @42); + if (bcx.build.is_terminated()) { + // This means an earlier arg was divergent. + // So this arg can't be evaluated. + ret tup(bcx, [], C_nil()); + } + auto retty = ty::ty_fn_ret(cx.fcx.lcx.ccx.tcx, fn_ty); auto llretslot_res = alloc_ty(bcx, retty); bcx = llretslot_res.bcx;