authorgravatar for 4678790+dweiller@users.noreply.github.comDominic <4678790+dweiller@users.noreply.github.com> 2023-03-10 13:03:40+11:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-04-30 16:34:34-07:00
log1b432072b5ae6a70a00464b48b7ebf8610293fc3
treef28fec8110ce57d8cd7d7ba578645971cbe3491e
parent339cae7fd0af5730673fcba7d97568af24b5aa4f

std.Build: detect and disallow top-level step name clashes


1 files changed, 6 insertions(+), 1 deletions(-)

lib/std/Build.zig+6-1
...@@ -926,7 +926,12 @@ pub fn step(self: *Build, name: []const u8, description: []const u8) *Step {...@@ -926,7 +926,12 @@ pub fn step(self: *Build, name: []const u8, description: []const u8) *Step {
926 }),926 }),
927 .description = self.dupe(description),927 .description = self.dupe(description),
928 };928 };
929 self.top_level_steps.put(self.allocator, step_info.step.name, step_info) catch @panic("OOM");929 const gop = self.top_level_steps.getOrPut(self.allocator, name) catch @panic("OOM");
930 if (gop.found_existing) std.debug.panic("A top-level step with name \"{s}\" already exists", .{name});
931
932 gop.key_ptr.* = step_info.step.name;
933 gop.value_ptr.* = step_info;
934
930 return &step_info.step;935 return &step_info.step;
931}936}
932937