diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2023-10-08 18:23:26 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2023-10-08 18:23:38 -0700 |
| commit | 1b372f187223c39eb32a54c96d50aff6ab08c9d6 (patch) | |
| tree | 7904502d9a5118ebdb9b1aef4a97cbef397e5503 /src/Compilation.zig | |
| parent | 5e7c44a3211dc8b1bb0b6d3d4764f8fd0b8c665b (diff) | |
| download | zig-1b372f187223c39eb32a54c96d50aff6ab08c9d6.tar.gz zig-1b372f187223c39eb32a54c96d50aff6ab08c9d6.zip | |
fix using the wrong allocator for modules
Diffstat (limited to 'src/Compilation.zig')
| -rw-r--r-- | src/Compilation.zig | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig index c2ce5f16f5..9f2b07c501 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -1352,11 +1352,14 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { }); } else null; - try main_mod.deps.put(gpa, "builtin", builtin_mod); - try main_mod.deps.put(gpa, "root", root_mod); - try main_mod.deps.put(gpa, "std", std_mod); - if (compiler_rt_mod) |m| - try main_mod.deps.put(gpa, "compiler_rt", m); + { + try main_mod.deps.ensureUnusedCapacity(arena, 4); + main_mod.deps.putAssumeCapacity("builtin", builtin_mod); + main_mod.deps.putAssumeCapacity("root", root_mod); + main_mod.deps.putAssumeCapacity("std", std_mod); + if (compiler_rt_mod) |m| + main_mod.deps.putAssumeCapacity("compiler_rt", m); + } // Pre-open the directory handles for cached ZIR code so that it does not need // to redundantly happen for each AstGen operation. |
