| author | |
| committer | |
| log | 3d23ba9c352b93a299d17e85d9a758cfac613d23 |
| tree | adbfde693ae4952daabce2aea03a3c6216acc846 |
| parent | f88b523065fbb8afbd723fd6e803ace0334b713c |
This reverts commit f88b523065fbb8afbd723fd6e803ace0334b713c.
Let's please go through the language proposal process for this change. I
don't see any justification for this breaking change even in the commit
message.4 files changed, 25 insertions(+), 28 deletions(-)
src/Sema.zig+3-8| ... | ... | @@ -1292,7 +1292,9 @@ fn analyzeBodyInner( |
| 1292 | 1292 | continue; |
| 1293 | 1293 | }, |
| 1294 | 1294 | .breakpoint => { |
| 1295 | try sema.zirBreakpoint(block, extended); | |
| 1295 | if (!block.is_comptime) { | |
| 1296 | _ = try block.addNoOp(.breakpoint); | |
| 1297 | } | |
| 1296 | 1298 | i += 1; |
| 1297 | 1299 | continue; |
| 1298 | 1300 | }, |
| ... | ... | @@ -5618,13 +5620,6 @@ fn zirTrap(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Zir.In |
| 5618 | 5620 | return always_noreturn; |
| 5619 | 5621 | } |
| 5620 | 5622 | |
| 5621 | fn zirBreakpoint(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData) CompileError!void { | |
| 5622 | const src = LazySrcLoc.nodeOffset(@bitCast(extended.operand)); | |
| 5623 | if (block.is_comptime) | |
| 5624 | return sema.fail(block, src, "encountered @breakpoint at comptime", .{}); | |
| 5625 | _ = try block.addNoOp(.breakpoint); | |
| 5626 | } | |
| 5627 | ||
| 5628 | 5623 | fn zirLoop(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5629 | 5624 | const tracy = trace(@src()); |
| 5630 | 5625 | defer tracy.end(); |
test/cases/compile_errors/@trap_comptime_call.zig created+9| ... | ... | @@ -0,0 +1,9 @@ |
| 1 | export fn entry() void { | |
| 2 | comptime @trap(); | |
| 3 | } | |
| 4 | ||
| 5 | // error | |
| 6 | // backend=stage2 | |
| 7 | // target=native | |
| 8 | // | |
| 9 | // :2:14: error: encountered @trap at comptime |
test/cases/compile_errors/panic_called_at_compile_time.zig created+13| ... | ... | @@ -0,0 +1,13 @@ |
| 1 | export fn entry() void { | |
| 2 | comptime { | |
| 3 | @panic( | |
| 4 | "aoeu", | |
| 5 | ); | |
| 6 | } | |
| 7 | } | |
| 8 | ||
| 9 | // error | |
| 10 | // backend=stage2 | |
| 11 | // target=native | |
| 12 | // | |
| 13 | // :3:9: error: encountered @panic at comptime |
test/cases/compile_errors/runtime-only_builtins_called_at_comptime.zig deleted-20| ... | ... | @@ -1,20 +0,0 @@ |
| 1 | test "comptime @panic call" { | |
| 2 | comptime @panic("amogus"); | |
| 3 | } | |
| 4 | ||
| 5 | test "comptime @trap call" { | |
| 6 | comptime @trap(); | |
| 7 | } | |
| 8 | ||
| 9 | test "comptime @breakpoint call" { | |
| 10 | comptime @breakpoint(); | |
| 11 | } | |
| 12 | ||
| 13 | // error | |
| 14 | // backend=stage2 | |
| 15 | // target=native | |
| 16 | // is_test=true | |
| 17 | // | |
| 18 | // :2:14: error: encountered @panic at comptime | |
| 19 | // :6:14: error: encountered @trap at comptime | |
| 20 | // :10:14: error: encountered @breakpoint at comptime |