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:
parent
cc2bd02827
commit
3e25444e51
@ -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(
|
||||||
|
4
src/test/run-fail/do-while-fail.rs
Normal file
4
src/test/run-fail/do-while-fail.rs
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
// error-pattern:giraffe
|
||||||
|
fn main() {
|
||||||
|
fail do { fail "giraffe" } while true;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user