aboutsummaryrefslogtreecommitdiff
path: root/src/Sema.zig
diff options
context:
space:
mode:
authormlugg <mlugg@mlugg.co.uk>2024-03-06 21:24:38 +0000
committermlugg <mlugg@mlugg.co.uk>2024-03-06 21:26:39 +0000
commitb41a0b4768d368d81d0d33c779f919d8f315e622 (patch)
tree36bcd210c4eedce2b3bb68fe6c097dc79219e84f /src/Sema.zig
parent4c05a9a892d68749f3d7da26ee0e884158640720 (diff)
downloadzig-b41a0b4768d368d81d0d33c779f919d8f315e622.tar.gz
zig-b41a0b4768d368d81d0d33c779f919d8f315e622.zip
Package.Module: deduplicate identical builtin modules
Previously, when multiple modules had builtin modules with identical sources, two distinct `Module`s and `File`s were created pointing at the same file path. This led to a bug later in the frontend. These modules are now deduplicated with a simple hashmap on the builtin source.
Diffstat (limited to 'src/Sema.zig')
-rw-r--r--src/Sema.zig1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/Sema.zig b/src/Sema.zig
index 2ea7432c0e..cff7404a3b 100644
--- a/src/Sema.zig
+++ b/src/Sema.zig
@@ -5858,6 +5858,7 @@ fn zirCImport(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileEr
.global = comp.config,
.parent = parent_mod,
.builtin_mod = parent_mod.getBuiltinDependency(),
+ .builtin_modules = null, // `builtin_mod` is set
}) catch |err| switch (err) {
// None of these are possible because we are creating a package with
// the exact same configuration as the parent package, which already