stage2: handle function dependency failures without crashing

This commit is contained in:
Andrew Kelley 2021-12-28 18:01:40 -07:00
parent c0ae9647f9
commit 6229d37dcf
2 changed files with 8 additions and 1 deletions

View File

@ -2350,7 +2350,12 @@ fn processOneJob(comp: *Compilation, job: Job, main_progress_node: *std.Progress
var air = module.analyzeFnBody(decl, func, sema_arena) catch |err| switch (err) {
error.AnalysisFail => {
assert(func.state != .in_progress);
if (func.state == .in_progress) {
// If this decl caused the compile error, the analysis field would
// be changed to indicate it was this Decl's fault. Because this
// did not happen, we infer here that it was a dependency failure.
func.state = .dependency_failure;
}
return;
},
error.OutOfMemory => return error.OutOfMemory,

View File

@ -1543,6 +1543,8 @@ pub const Value = extern union {
hash(slice.len, Type.usize, hasher);
},
// For these, hash them as hash of a pointer to the decl,
// combined with a hash of the byte offset from the decl.
.elem_ptr => @panic("TODO: Implement more pointer hashing cases"),
.field_ptr => @panic("TODO: Implement more pointer hashing cases"),
.eu_payload_ptr => @panic("TODO: Implement more pointer hashing cases"),