remove the "top of the comptime stack" compile error
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 #1949
This commit is contained in:
parent
a4e32d9fb1
commit
c58b802034
@ -18172,12 +18172,6 @@ static IrInstruction *ir_analyze_instruction_type_id(IrAnalyze *ira,
|
||||
static IrInstruction *ir_analyze_instruction_set_eval_branch_quota(IrAnalyze *ira,
|
||||
IrInstructionSetEvalBranchQuota *instruction)
|
||||
{
|
||||
if (ira->new_irb.exec->parent_exec != nullptr && !ira->new_irb.exec->is_generic_instantiation) {
|
||||
ir_add_error(ira, &instruction->base,
|
||||
buf_sprintf("@setEvalBranchQuota must be called from the top of the comptime stack"));
|
||||
return ira->codegen->invalid_instruction;
|
||||
}
|
||||
|
||||
uint64_t new_quota;
|
||||
if (!ir_resolve_usize(ira, instruction->new_quota->child, &new_quota))
|
||||
return ira->codegen->invalid_instruction;
|
||||
|
@ -4554,20 +4554,6 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
|
||||
".tmp_source.zig:2:24: error: expected [2]u8 literal, found [3]u8 literal",
|
||||
);
|
||||
|
||||
cases.add(
|
||||
"@setEvalBranchQuota in non-root comptime execution context",
|
||||
\\comptime {
|
||||
\\ foo();
|
||||
\\}
|
||||
\\fn foo() void {
|
||||
\\ @setEvalBranchQuota(1001);
|
||||
\\}
|
||||
,
|
||||
".tmp_source.zig:5:5: error: @setEvalBranchQuota must be called from the top of the comptime stack",
|
||||
".tmp_source.zig:2:8: note: called from here",
|
||||
".tmp_source.zig:1:10: note: called from here",
|
||||
);
|
||||
|
||||
cases.add(
|
||||
"wrong pointer implicitly casted to pointer to @OpaqueType()",
|
||||
\\const Derp = @OpaqueType();
|
||||
|
Loading…
x
Reference in New Issue
Block a user