authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-07-03 11:47:58-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-07-03 15:31:29-07:00
log3ef9bd587987710591724448ddfe28288d3abff8
tree11a78e9bff7d17ad2f6958bd90ac20fa8d0b2470
parentf385522ab0d40a21303d3b40f963a3a466ec42e5

stage2: add the zig version to AstGen cache hash

This solves the problem of different versions of Zig having different binary representations of ZIR code. closes #9290

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

src/Module.zig+2
......@@ -27,6 +27,7 @@ const trace = @import("tracy.zig").trace;
2727const AstGen = @import("AstGen.zig");
2828const Sema = @import("Sema.zig");
2929const target_util = @import("target.zig");
30const build_options = @import("build_options");
3031
3132/// General-purpose allocator. Used for both temporary and long-term storage.
3233gpa: *Allocator,
......@@ -2223,6 +2224,7 @@ pub fn astGenFile(mod: *Module, file: *Scope.File, prog_node: *std.Progress.Node
22232224 const want_local_cache = file.pkg == mod.root_pkg;
22242225 const digest = hash: {
22252226 var path_hash: Cache.HashHelper = .{};
2227 path_hash.addBytes(build_options.version);
22262228 if (!want_local_cache) {
22272229 path_hash.addOptionalBytes(file.pkg.root_src_directory.path);
22282230 }