From 0f3c883245f27870472978f738d6e81958e15c52 Mon Sep 17 00:00:00 2001 From: Matthew Lugg Date: Sun, 8 Mar 2026 13:49:24 +0000 Subject: [PATCH] Sema: always track references I think not tracking these already causes some bugs on master with `-freference-trace=0`, but it now definitely causes bugs, because we want the reference information to decide how to write dependency loop errors. Let's begin to lean into the incremental-by-default future by disabling this small optimization---the compiler is starting to use a lot of the "incremental" logic even in non-incremental builds at this point, so the separation is becoming less and less! This particular optimization wasn't even that useful, because it's very rare for users to build with `-freference-trace=0`. --- src/Sema.zig | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Sema.zig b/src/Sema.zig index b266940c0e91e309c788d156f3ab99d760d8d6ff..aa3bae74687d6774a75c4dd708187fbe1a4cf1cf 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -29920,7 +29920,6 @@ pub fn addReferenceEntry( .func => |f| assert(ip.unwrapCoercedFunc(f) == f), // for `.{ .func = f }`, `f` must be uncoerced else => {}, } - if (!zcu.comp.config.incremental and zcu.comp.reference_trace == 0) return; const gop = try sema.references.getOrPut(sema.gpa, referenced_unit); if (gop.found_existing) return; try zcu.addUnitReference(sema.owner, referenced_unit, src, inline_frame: { @@ -29937,7 +29936,6 @@ pub fn addTypeReferenceEntry( referenced_type: Type, ) !void { const zcu = sema.pt.zcu; - if (!zcu.comp.config.incremental and zcu.comp.reference_trace == 0) return; const gop = try sema.type_references.getOrPut(sema.gpa, referenced_type.toIntern()); if (gop.found_existing) return; try zcu.addTypeReference(sema.owner, referenced_type.toIntern(), src); -- 2.54.0