authorgravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2024-08-17 11:40:25+01:00
committergravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2024-08-17 18:50:10-04:00
log7f2466e65fe0b7411792ce3d3f186893ed22379d
tree1f2b8a6b80901dc07618129a4a1cb31a8e399fb5
parent9c3324173de2d8de80e95fb6be23eb63dfbc5169

std.BoundedArray: add clear()


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

lib/std/bounded_array.zig+5
......@@ -72,6 +72,11 @@ pub fn BoundedArrayAligned(
7272 self.len = @intCast(len);
7373 }
7474
75 /// Remove all elements from the slice.
76 pub fn clear(self: *Self) void {
77 self.len = 0;
78 }
79
7580 /// Copy the content of an existing slice.
7681 pub fn fromSlice(m: []const T) error{Overflow}!Self {
7782 var list = try init(m.len);
src/Compilation.zig+1-1
......@@ -2264,7 +2264,7 @@ pub fn update(comp: *Compilation, main_progress_node: std.Progress.Node) !void {
22642264 }
22652265 }
22662266
2267 zcu.analysis_roots.resize(0) catch unreachable;
2267 zcu.analysis_roots.clear();
22682268
22692269 try comp.queueJob(.{ .analyze_mod = std_mod });
22702270 zcu.analysis_roots.appendAssumeCapacity(std_mod);