authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-12-28 18:01:40-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-12-28 20:20:30-07:00
log6229d37dcfec393880109c7aaed1c18d08756631
tree53be7676398223c6f956a2566f4aca09204891b5
parentc0ae9647f9656ea47c49ffd64443b7da73aeffc7

stage2: handle function dependency failures without crashing


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

src/Compilation.zig+6-1
......@@ -2350,7 +2350,12 @@ fn processOneJob(comp: *Compilation, job: Job, main_progress_node: *std.Progress
23502350
23512351 var air = module.analyzeFnBody(decl, func, sema_arena) catch |err| switch (err) {
23522352 error.AnalysisFail => {
2353 assert(func.state != .in_progress);
2353 if (func.state == .in_progress) {
2354 // If this decl caused the compile error, the analysis field would
2355 // be changed to indicate it was this Decl's fault. Because this
2356 // did not happen, we infer here that it was a dependency failure.
2357 func.state = .dependency_failure;
2358 }
23542359 return;
23552360 },
23562361 error.OutOfMemory => return error.OutOfMemory,
src/value.zig+2
......@@ -1543,6 +1543,8 @@ pub const Value = extern union {
15431543 hash(slice.len, Type.usize, hasher);
15441544 },
15451545
1546 // For these, hash them as hash of a pointer to the decl,
1547 // combined with a hash of the byte offset from the decl.
15461548 .elem_ptr => @panic("TODO: Implement more pointer hashing cases"),
15471549 .field_ptr => @panic("TODO: Implement more pointer hashing cases"),
15481550 .eu_payload_ptr => @panic("TODO: Implement more pointer hashing cases"),