diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2021-12-28 18:01:40 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-12-28 20:20:30 -0700 |
| commit | 6229d37dcfec393880109c7aaed1c18d08756631 (patch) | |
| tree | 53be7676398223c6f956a2566f4aca09204891b5 /src/Compilation.zig | |
| parent | c0ae9647f9656ea47c49ffd64443b7da73aeffc7 (diff) | |
| download | zig-6229d37dcfec393880109c7aaed1c18d08756631.tar.gz zig-6229d37dcfec393880109c7aaed1c18d08756631.zip | |
stage2: handle function dependency failures without crashing
Diffstat (limited to 'src/Compilation.zig')
| -rw-r--r-- | src/Compilation.zig | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig index 6e3a955632..cd4794554e 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -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, |
