authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-05-05 17:00:10-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-05-05 17:00:10-07:00
log17067e0e6b6d28623b47b639853abc69a83b620a
tree6699eaf7624cf486158d4b0481b617c3b3320ae9
parent9b1aac8a654d1ee3515e2de8d477cf1909e63fdf

stage2: fix contents hash computation

during an incremental update change detection, the function call to get the old contents hash took place after mangling the old ZIR index, making it access the wrong array index.

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

src/Module.zig+1-1
......@@ -2436,6 +2436,7 @@ fn updateZirRefs(gpa: *Allocator, file: *Scope.File, old_zir: Zir) !UpdateChange
24362436 // Anonymous decls and the root decl have this set to 0. We still need
24372437 // to walk them but we do not need to modify this value.
24382438 if (decl.zir_decl_index != 0) {
2439 const old_hash = decl.contentsHashZir(old_zir);
24392440 decl.zir_decl_index = extra_map.get(decl.zir_decl_index) orelse {
24402441 try deleted_decls.append(gpa, decl);
24412442 continue;
......@@ -2446,7 +2447,6 @@ fn updateZirRefs(gpa: *Allocator, file: *Scope.File, old_zir: Zir) !UpdateChange
24462447 };
24472448 decl.name = new_zir.nullTerminatedString(new_name_index).ptr;
24482449
2449 const old_hash = decl.contentsHashZir(old_zir);
24502450 const new_hash = decl.contentsHashZir(new_zir);
24512451 if (!std.zig.srcHashEql(old_hash, new_hash)) {
24522452 try outdated_decls.append(gpa, decl);