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...@@ -2350,7 +2350,12 @@ fn processOneJob(comp: *Compilation, job: Job, main_progress_node: *std.Progress
23502350
2351 var air = module.analyzeFnBody(decl, func, sema_arena) catch |err| switch (err) {2351 var air = module.analyzeFnBody(decl, func, sema_arena) catch |err| switch (err) {
2352 error.AnalysisFail => {2352 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 }
2354 return;2359 return;
2355 },2360 },
2356 error.OutOfMemory => return error.OutOfMemory,2361 error.OutOfMemory => return error.OutOfMemory,
src/value.zig+2
...@@ -1543,6 +1543,8 @@ pub const Value = extern union {...@@ -1543,6 +1543,8 @@ pub const Value = extern union {
1543 hash(slice.len, Type.usize, hasher);1543 hash(slice.len, Type.usize, hasher);
1544 },1544 },
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.
1546 .elem_ptr => @panic("TODO: Implement more pointer hashing cases"),1548 .elem_ptr => @panic("TODO: Implement more pointer hashing cases"),
1547 .field_ptr => @panic("TODO: Implement more pointer hashing cases"),1549 .field_ptr => @panic("TODO: Implement more pointer hashing cases"),
1548 .eu_payload_ptr => @panic("TODO: Implement more pointer hashing cases"),1550 .eu_payload_ptr => @panic("TODO: Implement more pointer hashing cases"),