Commit faafeb51af
Changed files (4)
lib
std
Build
test
standalone
depend_on_main_mod
lib/std/Build/Step/Compile.zig
@@ -22,7 +22,7 @@ const Path = std.Build.Cache.Path;
pub const base_id: Step.Id = .compile;
step: Step,
-root_module: Module,
+root_module: *Module,
name: []const u8,
linker_script: ?LazyPath = null,
@@ -432,7 +432,9 @@ pub fn create(owner: *std.Build, options: Options) *Compile {
.zig_process = null,
};
- compile.root_module.init(owner, options.root_module, compile);
+ const root_module = owner.allocator.create(Module) catch @panic("OOM");
+ root_module.init(owner, options.root_module, compile);
+ compile.root_module = root_module;
if (options.zig_lib_dir) |lp| {
compile.zig_lib_dir = lp.dupe(compile.step.owner);
@@ -1089,7 +1091,7 @@ fn getZigArgs(compile: *Compile, fuzz: bool) ![][]const u8 {
}
}
- var cli_named_modules = try CliNamedModules.init(arena, &compile.root_module);
+ var cli_named_modules = try CliNamedModules.init(arena, compile.root_module);
// For this loop, don't chase dynamic libraries because their link
// objects are already linked.
lib/std/Build/Step/Run.zig
@@ -1722,7 +1722,7 @@ fn addPathForDynLibs(run: *Run, artifact: *Step.Compile) void {
var it = artifact.root_module.iterateDependencies(artifact, true);
while (it.next()) |item| {
const other = item.compile.?;
- if (item.module == &other.root_module) {
+ if (item.module == other.root_module) {
if (item.module.resolved_target.?.result.os.tag == .windows and
other.isDynamicLibrary())
{
lib/std/Build/Module.zig
@@ -430,7 +430,7 @@ pub const DependencyIterator = struct {
if (!it.chase_dyn_libs and compile.isDynamicLibrary()) continue;
it.set.put(it.allocator, .{
- .module = &compile.root_module,
+ .module = compile.root_module,
.compile = compile,
}, "root") catch @panic("OOM");
},
test/standalone/depend_on_main_mod/build.zig
@@ -18,7 +18,7 @@ pub fn build(b: *std.Build) void {
.root_source_file = b.path("src/foo.zig"),
});
- foo_module.addImport("root2", &exe.root_module);
+ foo_module.addImport("root2", exe.root_module);
exe.root_module.addImport("foo", foo_module);
const run_cmd = b.addRunArtifact(exe);