Revert "Handle conditionals on _|_ - typed values correctly"
This reverts commit 13f8b3f2a6
.
run-pass/if-ret.rs does not translate correctly when unoptimized. Issue #797
This commit is contained in:
parent
d08c0f0ec1
commit
ea81c03960
|
@ -3592,18 +3592,6 @@ fn trans_if(cx: &@block_ctxt, cond: &@ast::expr, thn: &ast::blk,
|
|||
els: &option::t[@ast::expr], id: ast::node_id,
|
||||
output: &out_method) -> result {
|
||||
let cond_res = trans_expr(cx, cond);
|
||||
|
||||
if (ty::type_is_bot(bcx_tcx(cx), ty::expr_ty(bcx_tcx(cx), cond))) {
|
||||
// No need to generate code for comparison,
|
||||
// since the cond diverges.
|
||||
if (!cx.build.is_terminated()) {
|
||||
ret rslt(cx, cx.build.Unreachable());
|
||||
}
|
||||
else {
|
||||
ret rslt(cx, C_nil());
|
||||
}
|
||||
}
|
||||
|
||||
let then_cx = new_scope_block_ctxt(cx, "then");
|
||||
let then_res = trans_block(then_cx, thn, output);
|
||||
let else_cx = new_scope_block_ctxt(cx, "else");
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
// error-pattern:quux
|
||||
fn my_err(s: str) -> ! { log_err s; fail "quux"; }
|
||||
fn main() { if my_err("bye") { } }
|
Loading…
Reference in New Issue