aboutsummaryrefslogtreecommitdiff
path: root/src/Zcu/PerThread.zig
diff options
context:
space:
mode:
authorJacob Young <jacobly0@users.noreply.github.com>2024-08-26 00:42:32 -0400
committerJacob Young <jacobly0@users.noreply.github.com>2024-08-27 02:09:59 -0400
commit26d4fd5276eaaa939cf21a516265101c551b62f2 (patch)
treef0adbe73252a37aebf70063287288094d7699307 /src/Zcu/PerThread.zig
parent8c3f6c72c07e853e28cf7226a3f76da2fd5a9c6e (diff)
downloadzig-26d4fd5276eaaa939cf21a516265101c551b62f2.tar.gz
zig-26d4fd5276eaaa939cf21a516265101c551b62f2.zip
Zcu: avoid trying to link failed container types and contained navs
Diffstat (limited to 'src/Zcu/PerThread.zig')
-rw-r--r--src/Zcu/PerThread.zig15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/Zcu/PerThread.zig b/src/Zcu/PerThread.zig
index b5038ff045..67e0e9ee8b 100644
--- a/src/Zcu/PerThread.zig
+++ b/src/Zcu/PerThread.zig
@@ -2560,12 +2560,17 @@ pub fn populateTestFunctions(
pub fn linkerUpdateNav(pt: Zcu.PerThread, nav_index: InternPool.Nav.Index) !void {
const zcu = pt.zcu;
const comp = zcu.comp;
+ const ip = &zcu.intern_pool;
const nav = zcu.intern_pool.getNav(nav_index);
- const codegen_prog_node = zcu.codegen_prog_node.start(nav.fqn.toSlice(&zcu.intern_pool), 0);
+ const codegen_prog_node = zcu.codegen_prog_node.start(nav.fqn.toSlice(ip), 0);
defer codegen_prog_node.end();
- if (comp.bin_file) |lf| {
+ if (!Air.valFullyResolved(zcu.navValue(nav_index), zcu)) {
+ // The value of this nav failed to resolve. This is a transitive failure.
+ // TODO: do we need to mark this failure anywhere? I don't think so, since compilation
+ // will fail due to the type error anyway.
+ } else if (comp.bin_file) |lf| {
lf.updateNav(pt, nav_index) catch |err| switch (err) {
error.OutOfMemory => return error.OutOfMemory,
error.AnalysisFail => {
@@ -2605,7 +2610,11 @@ pub fn linkerUpdateContainerType(pt: Zcu.PerThread, ty: InternPool.Index) !void
const codegen_prog_node = zcu.codegen_prog_node.start(Type.fromInterned(ty).containerTypeName(ip).toSlice(ip), 0);
defer codegen_prog_node.end();
- if (comp.bin_file) |lf| {
+ if (!Air.typeFullyResolved(Type.fromInterned(ty), zcu)) {
+ // This type failed to resolve. This is a transitive failure.
+ // TODO: do we need to mark this failure anywhere? I don't think so, since compilation
+ // will fail due to the type error anyway.
+ } else if (comp.bin_file) |lf| {
lf.updateContainerType(pt, ty) catch |err| switch (err) {
error.OutOfMemory => return error.OutOfMemory,
else => |e| log.err("codegen type failed: {s}", .{@errorName(e)}),