In trans, allow _|_-typed things to be the argument to fail

Rationale: _|_-typed things diverge, so it's safe to use them in
any context.

Closes #1465
This commit is contained in:
Tim Chevalier 2012-01-19 13:29:26 -08:00
parent cc2bd02827
commit 3e25444e51
2 changed files with 5 additions and 1 deletions

View File

@ -3775,7 +3775,7 @@ fn trans_fail_expr(bcx: @block_ctxt, sp_opt: option::t<span>,
bcx, expr_res.val, type_of_or_i8( bcx, expr_res.val, type_of_or_i8(
bcx, ty::mk_mach_uint(tcx, ast::ty_u8))); bcx, ty::mk_mach_uint(tcx, ast::ty_u8)));
ret trans_fail_value(bcx, sp_opt, data); ret trans_fail_value(bcx, sp_opt, data);
} else if bcx.unreachable { } else if bcx.unreachable || ty::type_is_bot(tcx, e_ty) {
ret bcx; ret bcx;
} else { } else {
bcx_ccx(bcx).sess.span_bug( bcx_ccx(bcx).sess.span_bug(

View File

@ -0,0 +1,4 @@
// error-pattern:giraffe
fn main() {
fail do { fail "giraffe" } while true;
}