Skip to content

Commit de82e8d

Browse files
committed
frontend: fix use of undefined progress node
This was causing a crash when running `zig test`.
1 parent 8b32daa commit de82e8d

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/Module.zig

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5340,15 +5340,13 @@ pub fn populateTestFunctions(
53405340
// We have to call `ensureDeclAnalyzed` here in case `builtin.test_functions`
53415341
// was not referenced by start code.
53425342
mod.sema_prog_node = main_progress_node.start("Semantic Analysis", 0);
5343-
mod.codegen_prog_node = main_progress_node.start("Code Generation", 0);
53445343
defer {
53455344
mod.sema_prog_node.end();
53465345
mod.sema_prog_node = undefined;
5347-
mod.codegen_prog_node.end();
5348-
mod.codegen_prog_node = undefined;
53495346
}
53505347
try mod.ensureDeclAnalyzed(decl_index);
53515348
}
5349+
53525350
const decl = mod.declPtr(decl_index);
53535351
const test_fn_ty = decl.typeOf(mod).slicePtrFieldType(mod).childType(mod);
53545352

@@ -5449,7 +5447,15 @@ pub fn populateTestFunctions(
54495447
decl.val = new_val;
54505448
decl.has_tv = true;
54515449
}
5452-
try mod.linkerUpdateDecl(decl_index);
5450+
{
5451+
mod.codegen_prog_node = main_progress_node.start("Code Generation", 0);
5452+
defer {
5453+
mod.codegen_prog_node.end();
5454+
mod.codegen_prog_node = undefined;
5455+
}
5456+
5457+
try mod.linkerUpdateDecl(decl_index);
5458+
}
54535459
}
54545460

54555461
pub fn linkerUpdateDecl(zcu: *Zcu, decl_index: Decl.Index) !void {

0 commit comments

Comments
 (0)