authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-02-24 15:07:46-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-02-24 15:07:46-05:00
logcd992b89d2252fade1e56b5e4e7537b171af890e
treefe22efaf2003a0bf5b34b872e621d45276b5b29d
parenta665872e881920e8020a513340d2427b88a55bd6

fix unwrap error payload not emitting debug safety


2 files changed, 15 insertions(+), 1 deletions(-)

src/ir.cpp+1-1
...@@ -12423,6 +12423,7 @@ bool ir_has_side_effects(IrInstruction *instruction) {...@@ -12423,6 +12423,7 @@ bool ir_has_side_effects(IrInstruction *instruction) {
12423 case IrInstructionIdCheckSwitchProngs:12423 case IrInstructionIdCheckSwitchProngs:
12424 case IrInstructionIdSetGlobalAlign:12424 case IrInstructionIdSetGlobalAlign:
12425 case IrInstructionIdSetGlobalSection:12425 case IrInstructionIdSetGlobalSection:
12426 case IrInstructionIdUnwrapErrPayload:
12426 return true;12427 return true;
12427 case IrInstructionIdPhi:12428 case IrInstructionIdPhi:
12428 case IrInstructionIdUnOp:12429 case IrInstructionIdUnOp:
...@@ -12471,7 +12472,6 @@ bool ir_has_side_effects(IrInstruction *instruction) {...@@ -12471,7 +12472,6 @@ bool ir_has_side_effects(IrInstruction *instruction) {
12471 case IrInstructionIdFrameAddress:12472 case IrInstructionIdFrameAddress:
12472 case IrInstructionIdTestErr:12473 case IrInstructionIdTestErr:
12473 case IrInstructionIdUnwrapErrCode:12474 case IrInstructionIdUnwrapErrCode:
12474 case IrInstructionIdUnwrapErrPayload:
12475 case IrInstructionIdMaybeWrap:12475 case IrInstructionIdMaybeWrap:
12476 case IrInstructionIdErrWrapCode:12476 case IrInstructionIdErrWrapCode:
12477 case IrInstructionIdErrWrapPayload:12477 case IrInstructionIdErrWrapPayload:
test/run_tests.cpp+14
...@@ -1896,6 +1896,20 @@ fn unsigned_cast(x: i32) -> u32 {...@@ -1896,6 +1896,20 @@ fn unsigned_cast(x: i32) -> u32 {
1896}1896}
1897 )SOURCE");1897 )SOURCE");
18981898
1899 add_debug_safety_case("unwrap error", R"SOURCE(
1900pub fn panic(message: []const u8) -> unreachable {
1901 @breakpoint();
1902 while (true) {}
1903}
1904error Whatever;
1905pub fn main(args: [][]u8) -> %void {
1906 %%bar();
1907}
1908fn bar() -> %void {
1909 return error.Whatever;
1910}
1911 )SOURCE");
1912
1899}1913}
19001914
1901//////////////////////////////////////////////////////////////////////////////1915//////////////////////////////////////////////////////////////////////////////