| author | |
| committer | |
| log | c58b80203443dcbf8b737ebdaa1f17fb20c77711 |
| tree | b1e9af991951c68e1fa7042b2f75091a61c0c8cf |
| parent | a4e32d9fb143dbfb622a5097ea4a1e4bcad03463 |
| signature |
It's still best practice to put `@setEvalBranchQuota` at the top of
the comptime stack, but as Jimmi notes in #1949, when a function
can be called at comptime and also can be the top of the comptime stack,
this compile error is fundamentally unsound.
So now it's gone.
closes #19492 files changed, 0 insertions(+), 20 deletions(-)
src/ir.cpp-6| ... | ... | @@ -18172,12 +18172,6 @@ static IrInstruction *ir_analyze_instruction_type_id(IrAnalyze *ira, |
| 18172 | 18172 | static IrInstruction *ir_analyze_instruction_set_eval_branch_quota(IrAnalyze *ira, |
| 18173 | 18173 | IrInstructionSetEvalBranchQuota *instruction) |
| 18174 | 18174 | { |
| 18175 | if (ira->new_irb.exec->parent_exec != nullptr && !ira->new_irb.exec->is_generic_instantiation) { | |
| 18176 | ir_add_error(ira, &instruction->base, | |
| 18177 | buf_sprintf("@setEvalBranchQuota must be called from the top of the comptime stack")); | |
| 18178 | return ira->codegen->invalid_instruction; | |
| 18179 | } | |
| 18180 | ||
| 18181 | 18175 | uint64_t new_quota; |
| 18182 | 18176 | if (!ir_resolve_usize(ira, instruction->new_quota->child, &new_quota)) |
| 18183 | 18177 | return ira->codegen->invalid_instruction; |
test/compile_errors.zig-14| ... | ... | @@ -4554,20 +4554,6 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { |
| 4554 | 4554 | ".tmp_source.zig:2:24: error: expected [2]u8 literal, found [3]u8 literal", |
| 4555 | 4555 | ); |
| 4556 | 4556 | |
| 4557 | cases.add( | |
| 4558 | "@setEvalBranchQuota in non-root comptime execution context", | |
| 4559 | \\comptime { | |
| 4560 | \\ foo(); | |
| 4561 | \\} | |
| 4562 | \\fn foo() void { | |
| 4563 | \\ @setEvalBranchQuota(1001); | |
| 4564 | \\} | |
| 4565 | , | |
| 4566 | ".tmp_source.zig:5:5: error: @setEvalBranchQuota must be called from the top of the comptime stack", | |
| 4567 | ".tmp_source.zig:2:8: note: called from here", | |
| 4568 | ".tmp_source.zig:1:10: note: called from here", | |
| 4569 | ); | |
| 4570 | ||
| 4571 | 4557 | cases.add( |
| 4572 | 4558 | "wrong pointer implicitly casted to pointer to @OpaqueType()", |
| 4573 | 4559 | \\const Derp = @OpaqueType(); |