From 9ae739c4c95aec30e2ac4c49d0dc879ff4b5d169 Mon Sep 17 00:00:00 2001 From: Arnold Filip Date: Mon, 21 Jul 2025 15:00:15 +0200 Subject: [PATCH 01/20] Fix zig 0.15.0-dev.1149+4e6a04929 build errors --- build.zig | 11 +++++------ test/tests.zig | 11 +++++++---- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/build.zig b/build.zig index 6c76917..7522dee 100644 --- a/build.zig +++ b/build.zig @@ -126,19 +126,18 @@ pub fn build(b: *Build) !void { if (!validate_exercises()) std.process.exit(2); use_color_escapes = false; - if (std.io.getStdErr().supportsAnsiEscapeCodes()) { + if (std.fs.File.stderr().supportsAnsiEscapeCodes()) { use_color_escapes = true; } else if (builtin.os.tag == .windows) { const w32 = struct { - const WINAPI = std.os.windows.WINAPI; const DWORD = std.os.windows.DWORD; const ENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x0004; const STD_ERROR_HANDLE: DWORD = @bitCast(@as(i32, -12)); - extern "kernel32" fn GetStdHandle(id: DWORD) callconv(WINAPI) ?*anyopaque; - extern "kernel32" fn GetConsoleMode(console: ?*anyopaque, out_mode: *DWORD) callconv(WINAPI) u32; - extern "kernel32" fn SetConsoleMode(console: ?*anyopaque, mode: DWORD) callconv(WINAPI) u32; + const GetStdHandle = std.os.windows.kernel32.GetStdHandle; + const GetConsoleMode = std.os.windows.kernel32.GetConsoleMode; + const SetConsoleMode = std.os.windows.kernel32.SetConsoleMode; }; - const handle = w32.GetStdHandle(w32.STD_ERROR_HANDLE); + const handle = w32.GetStdHandle(w32.STD_ERROR_HANDLE).?; var mode: w32.DWORD = 0; if (w32.GetConsoleMode(handle, &mode) != 0) { mode |= w32.ENABLE_VIRTUAL_TERMINAL_PROCESSING; diff --git a/test/tests.zig b/test/tests.zig index 5f64f8e..42c3653 100644 --- a/test/tests.zig +++ b/test/tests.zig @@ -161,7 +161,8 @@ const CheckNamedStep = struct { ); defer stderr_file.close(); - const stderr = stderr_file.reader(); + var buffer: [4096]u8 = undefined; + const stderr = stderr_file.reader(&buffer); { // Skip the logo. const nlines = mem.count(u8, root.logo, "\n"); @@ -213,7 +214,8 @@ const CheckStep = struct { ); defer stderr_file.close(); - const stderr = stderr_file.reader(); + var buffer: [4096]u8 = undefined; + const stderr = stderr_file.reader(&buffer); for (exercises) |ex| { if (ex.number() == 1) { // Skip the logo. @@ -298,7 +300,7 @@ fn check( } fn readLine(reader: fs.File.Reader, buf: []u8) !?[]const u8 { - if (try reader.readUntilDelimiterOrEof(buf, '\n')) |line| { + if (try reader.file.deprecatedReader().readUntilDelimiterOrEof(buf, '\n')) |line| { return mem.trimRight(u8, line, " \r\n"); } @@ -405,7 +407,8 @@ fn heal(allocator: Allocator, exercises: []const Exercise, work_path: []const u8 /// difference that returns an error when the temp path cannot be created. pub fn makeTempPath(b: *Build) ![]const u8 { const rand_int = std.crypto.random.int(u64); - const tmp_dir_sub_path = "tmp" ++ fs.path.sep_str ++ Build.hex64(rand_int); + const rand_hex64 = std.fmt.hex(rand_int); + const tmp_dir_sub_path = "tmp" ++ fs.path.sep_str ++ rand_hex64; const path = b.cache_root.join(b.allocator, &.{tmp_dir_sub_path}) catch @panic("OOM"); try b.cache_root.handle.makePath(tmp_dir_sub_path); From cb0a1a027f05371d1debc681949a269cf918aaab Mon Sep 17 00:00:00 2001 From: Chris Boesch Date: Mon, 21 Jul 2025 21:05:45 +0200 Subject: [PATCH 02/20] Removed patch files for async because of new formating errors. --- patches/patches/084_async.patch | 11 ----------- patches/patches/085_async2.patch | 10 ---------- patches/patches/086_async3.patch | 16 ---------------- patches/patches/087_async4.patch | 21 --------------------- patches/patches/088_async5.patch | 11 ----------- patches/patches/089_async6.patch | 13 ------------- patches/patches/090_async7.patch | 11 ----------- patches/patches/091_async8.patch | 26 -------------------------- 8 files changed, 119 deletions(-) delete mode 100644 patches/patches/084_async.patch delete mode 100644 patches/patches/085_async2.patch delete mode 100644 patches/patches/086_async3.patch delete mode 100644 patches/patches/087_async4.patch delete mode 100644 patches/patches/088_async5.patch delete mode 100644 patches/patches/089_async6.patch delete mode 100644 patches/patches/090_async7.patch delete mode 100644 patches/patches/091_async8.patch diff --git a/patches/patches/084_async.patch b/patches/patches/084_async.patch deleted file mode 100644 index 11a9da0..0000000 --- a/patches/patches/084_async.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- exercises/084_async.zig 2023-10-03 22:15:22.125574535 +0200 -+++ answers/084_async.zig 2023-10-05 20:04:07.219436606 +0200 -@@ -48,7 +48,7 @@ - pub fn main() void { - // Additional Hint: you can assign things to '_' when you - // don't intend to do anything with them. -- foo(); -+ _ = async foo(); - } - - fn foo() void { diff --git a/patches/patches/085_async2.patch b/patches/patches/085_async2.patch deleted file mode 100644 index ba10b05..0000000 --- a/patches/patches/085_async2.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- exercises/085_async2.zig 2023-10-03 22:15:22.125574535 +0200 -+++ answers/085_async2.zig 2023-10-05 20:04:07.226103397 +0200 -@@ -19,6 +19,7 @@ - - pub fn main() void { - var foo_frame = async foo(); -+ resume foo_frame; - } - - fn foo() void { diff --git a/patches/patches/086_async3.patch b/patches/patches/086_async3.patch deleted file mode 100644 index d80d4a1..0000000 --- a/patches/patches/086_async3.patch +++ /dev/null @@ -1,16 +0,0 @@ ---- exercises/086_async3.zig 2023-10-03 22:15:22.125574535 +0200 -+++ answers/086_async3.zig 2023-10-05 20:04:07.229436793 +0200 -@@ -13,7 +13,12 @@ - const n = 5; - var foo_frame = async foo(n); - -- ??? -+ // Silly solution. You can also use a loop. -+ resume foo_frame; -+ resume foo_frame; -+ resume foo_frame; -+ resume foo_frame; -+ resume foo_frame; - - print("\n", .{}); - } diff --git a/patches/patches/087_async4.patch b/patches/patches/087_async4.patch deleted file mode 100644 index b1c1736..0000000 --- a/patches/patches/087_async4.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- exercises/087_async4.zig 2023-10-03 22:15:22.125574535 +0200 -+++ answers/087_async4.zig 2023-10-05 20:04:07.236103584 +0200 -@@ -16,7 +16,7 @@ - - while (global_counter <= 5) { - print("{} ", .{global_counter}); -- ??? -+ resume foo_frame; - } - - print("\n", .{}); -@@ -24,7 +24,7 @@ - - fn foo() void { - while (true) { -- ??? -- ??? -+ global_counter += 1; -+ suspend {} - } - } diff --git a/patches/patches/088_async5.patch b/patches/patches/088_async5.patch deleted file mode 100644 index b9d5a21..0000000 --- a/patches/patches/088_async5.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- exercises/088_async5.zig 2023-10-03 22:15:22.125574535 +0200 -+++ answers/088_async5.zig 2023-10-05 20:04:07.239436980 +0200 -@@ -36,7 +36,7 @@ - pub fn main() void { - var myframe = async getPageTitle("http://example.com"); - -- var value = ??? -+ var value = await myframe; - - print("{s}\n", .{value}); - } diff --git a/patches/patches/089_async6.patch b/patches/patches/089_async6.patch deleted file mode 100644 index 4a0687e..0000000 --- a/patches/patches/089_async6.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- exercises/089_async6.zig 2023-10-03 22:15:22.125574535 +0200 -+++ answers/089_async6.zig 2023-10-05 20:04:07.242770376 +0200 -@@ -41,8 +41,8 @@ - var com_frame = async getPageTitle("http://example.com"); - var org_frame = async getPageTitle("http://example.org"); - -- var com_title = com_frame; -- var org_title = org_frame; -+ var com_title = await com_frame; -+ var org_title = await org_frame; - - print(".com: {s}, .org: {s}.\n", .{ com_title, org_title }); - } diff --git a/patches/patches/090_async7.patch b/patches/patches/090_async7.patch deleted file mode 100644 index 62ec057..0000000 --- a/patches/patches/090_async7.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- exercises/090_async7.zig 2023-10-03 22:15:22.125574535 +0200 -+++ answers/090_async7.zig 2023-10-05 20:04:07.249437167 +0200 -@@ -29,7 +29,7 @@ - // The main() function can not be async. But we know - // getBeef() will not suspend with this particular - // invocation. Please make this okay: -- var my_beef = getBeef(0); -+ var my_beef = nosuspend getBeef(0); - - print("beef? {X}!\n", .{my_beef}); - } diff --git a/patches/patches/091_async8.patch b/patches/patches/091_async8.patch deleted file mode 100644 index ddd3fce..0000000 --- a/patches/patches/091_async8.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- exercises/091_async8.zig 2023-10-03 22:15:22.125574535 +0200 -+++ answers/091_async8.zig 2023-10-05 20:04:07.252770563 +0200 -@@ -17,7 +17,7 @@ - - var frame = async suspendable(); - -- print("X", .{}); -+ print("D", .{}); - - resume frame; - -@@ -25,11 +25,11 @@ - } - - fn suspendable() void { -- print("X", .{}); -+ print("B", .{}); - - suspend { -- print("X", .{}); -+ print("C", .{}); - } - -- print("X", .{}); -+ print("E", .{}); - } From 49e73db5f5e139b610306ec6495aa6889eb83170 Mon Sep 17 00:00:00 2001 From: Chris Boesch Date: Tue, 22 Jul 2025 00:28:03 +0200 Subject: [PATCH 03/20] Switched to new reader version --- test/tests.zig | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/test/tests.zig b/test/tests.zig index 42c3653..b191610 100644 --- a/test/tests.zig +++ b/test/tests.zig @@ -161,8 +161,7 @@ const CheckNamedStep = struct { ); defer stderr_file.close(); - var buffer: [4096]u8 = undefined; - const stderr = stderr_file.reader(&buffer); + var stderr = stderr_file.readerStreaming(&.{}); { // Skip the logo. const nlines = mem.count(u8, root.logo, "\n"); @@ -170,10 +169,10 @@ const CheckNamedStep = struct { var lineno: usize = 0; while (lineno < nlines) : (lineno += 1) { - _ = try readLine(stderr, &buf); + _ = try readLine(&stderr, &buf); } } - try check_output(step, ex, stderr); + try check_output(step, ex, &stderr); } }; @@ -214,8 +213,7 @@ const CheckStep = struct { ); defer stderr_file.close(); - var buffer: [4096]u8 = undefined; - const stderr = stderr_file.reader(&buffer); + var stderr = stderr_file.readerStreaming(&.{}); for (exercises) |ex| { if (ex.number() == 1) { // Skip the logo. @@ -224,15 +222,15 @@ const CheckStep = struct { var lineno: usize = 0; while (lineno < nlines) : (lineno += 1) { - _ = try readLine(stderr, &buf); + _ = try readLine(&stderr, &buf); } } - try check_output(step, ex, stderr); + try check_output(step, ex, &stderr); } } }; -fn check_output(step: *Step, exercise: Exercise, reader: Reader) !void { +fn check_output(step: *Step, exercise: Exercise, reader: *Reader) !void { const b = step.owner; var buf: [1024]u8 = undefined; @@ -299,12 +297,9 @@ fn check( } } -fn readLine(reader: fs.File.Reader, buf: []u8) !?[]const u8 { - if (try reader.file.deprecatedReader().readUntilDelimiterOrEof(buf, '\n')) |line| { - return mem.trimRight(u8, line, " \r\n"); - } - - return null; +fn readLine(reader: *fs.File.Reader, buf: []u8) !?[]const u8 { + try reader.interface.readSliceAll(buf); + return mem.trimRight(u8, buf, " \r\n"); } /// Fails with a custom error message. From b499788606d83aac75e82da2d32b5b7ceb3d6896 Mon Sep 17 00:00:00 2001 From: Chris Boesch Date: Tue, 22 Jul 2025 00:40:06 +0200 Subject: [PATCH 04/20] Corrected the necessary Zig version --- build.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.zig b/build.zig index 7522dee..ebe6838 100644 --- a/build.zig +++ b/build.zig @@ -15,7 +15,7 @@ const print = std.debug.print; // 1) Getting Started // 2) Version Changes comptime { - const required_zig = "0.14.0-dev.1573"; + const required_zig = "0.15.0-dev.1092"; const current_zig = builtin.zig_version; const min_zig = std.SemanticVersion.parse(required_zig) catch unreachable; if (current_zig.order(min_zig) == .lt) { From f21f8f7863f512aed8ae0418351756819990df67 Mon Sep 17 00:00:00 2001 From: Arnold Filip Date: Tue, 22 Jul 2025 09:17:24 +0200 Subject: [PATCH 05/20] Update stdout writer usage to use std.fs.File --- exercises/026_hello2.zig | 4 ++-- exercises/034_quiz4.zig | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/exercises/026_hello2.zig b/exercises/026_hello2.zig index cd59b86..582dba9 100644 --- a/exercises/026_hello2.zig +++ b/exercises/026_hello2.zig @@ -16,12 +16,12 @@ const std = @import("std"); // pub fn main() !void { // We get a Writer for Standard Out so we can print() to it. - const stdout = std.io.getStdOut().writer(); + var stdout = std.fs.File.stdout().writer(&.{}); // Unlike std.debug.print(), the Standard Out writer can fail // with an error. We don't care _what_ the error is, we want // to be able to pass it up as a return value of main(). // // We just learned of a single statement which can accomplish this. - stdout.print("Hello world!\n", .{}); + stdout.interface.print("Hello world!\n", .{}); } diff --git a/exercises/034_quiz4.zig b/exercises/034_quiz4.zig index 2d843f2..8704397 100644 --- a/exercises/034_quiz4.zig +++ b/exercises/034_quiz4.zig @@ -10,11 +10,11 @@ const std = @import("std"); const NumError = error{IllegalNumber}; pub fn main() void { - const stdout = std.io.getStdOut().writer(); + var stdout = std.fs.File.stdout().writer(&.{}); const my_num: u32 = getNumber(); - try stdout.print("my_num={}\n", .{my_num}); + try stdout.interface.print("my_num={}\n", .{my_num}); } // This function is obviously weird and non-functional. But you will not be changing it for this quiz. From ed2f76e9600ce63405a5b4de0d7a2ea9f21cf4a6 Mon Sep 17 00:00:00 2001 From: Chris Boesch Date: Tue, 22 Jul 2025 10:08:24 +0200 Subject: [PATCH 06/20] Added patch files. --- patches/patches/026_hello2.patch | 8 ++++---- patches/patches/034_quiz4.patch | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/patches/patches/026_hello2.patch b/patches/patches/026_hello2.patch index f0224a1..f99cc67 100644 --- a/patches/patches/026_hello2.patch +++ b/patches/patches/026_hello2.patch @@ -1,9 +1,9 @@ ---- exercises/026_hello2.zig 2023-10-03 22:15:22.122241138 +0200 -+++ answers/026_hello2.zig 2023-10-05 20:04:06.959431737 +0200 +--- exercises/026_hello2.zig 2025-07-22 09:55:51.337832401 +0200 ++++ answers/026_hello2.zig 2025-07-22 10:00:11.233348058 +0200 @@ -23,5 +23,5 @@ // to be able to pass it up as a return value of main(). // // We just learned of a single statement which can accomplish this. -- stdout.print("Hello world!\n", .{}); -+ try stdout.print("Hello world!\n", .{}); +- stdout.interface.print("Hello world!\n", .{}); ++ try stdout.interface.print("Hello world!\n", .{}); } diff --git a/patches/patches/034_quiz4.patch b/patches/patches/034_quiz4.patch index 8c0bc0e..15c95fc 100644 --- a/patches/patches/034_quiz4.patch +++ b/patches/patches/034_quiz4.patch @@ -1,15 +1,15 @@ ---- exercises/034_quiz4.zig 2023-10-03 22:15:22.122241138 +0200 -+++ answers/034_quiz4.zig 2023-10-05 20:04:06.996099091 +0200 +--- exercises/034_quiz4.zig 2025-07-22 09:55:51.337832401 +0200 ++++ answers/034_quiz4.zig 2025-07-22 10:05:08.320323184 +0200 @@ -9,10 +9,10 @@ const NumError = error{IllegalNumber}; -pub fn main() void { +pub fn main() !void { - const stdout = std.io.getStdOut().writer(); + var stdout = std.fs.File.stdout().writer(&.{}); - const my_num: u32 = getNumber(); + const my_num: u32 = try getNumber(); - try stdout.print("my_num={}\n", .{my_num}); + try stdout.interface.print("my_num={}\n", .{my_num}); } From 54f48c75c415f03acba5c3744454e7e9e45840d4 Mon Sep 17 00:00:00 2001 From: Chris Boesch Date: Tue, 22 Jul 2025 10:16:17 +0200 Subject: [PATCH 07/20] Fixed 82 --- build.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.zig b/build.zig index ebe6838..f3dd2d2 100644 --- a/build.zig +++ b/build.zig @@ -1063,7 +1063,7 @@ const exercises = [_]Exercise{ .{ .main_file = "082_anonymous_structs3.zig", .output = - \\"0"(bool):true "1"(bool):false "2"(i32):42 "3"(f32):3.141592e0 + \\"0"(bool):true "1"(bool):false "2"(i32):42 "3"(f32):3.141592 , .hint = "This one is a challenge! But you have everything you need.", }, From 0d06220ec5d0623cef4d90a019040a984e9317f5 Mon Sep 17 00:00:00 2001 From: Chris Boesch Date: Tue, 22 Jul 2025 10:24:22 +0200 Subject: [PATCH 08/20] Fixed 98 --- exercises/098_bit_manipulation2.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exercises/098_bit_manipulation2.zig b/exercises/098_bit_manipulation2.zig index 979b103..8b51265 100644 --- a/exercises/098_bit_manipulation2.zig +++ b/exercises/098_bit_manipulation2.zig @@ -32,7 +32,7 @@ const print = std.debug.print; pub fn main() !void { // let's check the pangram - print("Is this a pangram? {?}!\n", .{isPangram("The quick brown fox jumps over the lazy dog.")}); + print("Is this a pangram? {}!\n", .{isPangram("The quick brown fox jumps over the lazy dog.")}); } fn isPangram(str: []const u8) bool { @@ -45,7 +45,7 @@ fn isPangram(str: []const u8) bool { // loop about all characters in the string for (str) |c| { // if the character is an alphabetical character - if (ascii.isASCII(c) and ascii.isAlphabetic(c)) { + if (ascii.isAscii(c) and ascii.isAlphabetic(c)) { // then we set the bit at the position // // to do this, we use a little trick: From f4619868961828bc943cd29d4e2c99edd76fbb00 Mon Sep 17 00:00:00 2001 From: Chris Boesch Date: Tue, 22 Jul 2025 10:30:19 +0200 Subject: [PATCH 09/20] Fixed 104 --- exercises/104_threading.zig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exercises/104_threading.zig b/exercises/104_threading.zig index 9c4e216..638769f 100644 --- a/exercises/104_threading.zig +++ b/exercises/104_threading.zig @@ -106,7 +106,7 @@ pub fn main() !void { // After the threads have been started, // they run in parallel and we can still do some work in between. - std.time.sleep(1500 * std.time.ns_per_ms); + std.Thread.sleep(1500 * std.time.ns_per_ms); std.debug.print("Some weird stuff, after starting the threads.\n", .{}); } // After we have left the closed area, we wait until @@ -117,12 +117,12 @@ pub fn main() !void { // This function is started with every thread that we set up. // In our example, we pass the number of the thread as a parameter. fn thread_function(num: usize) !void { - std.time.sleep(200 * num * std.time.ns_per_ms); + std.Thread.sleep(200 * num * std.time.ns_per_ms); std.debug.print("thread {d}: {s}\n", .{ num, "started." }); // This timer simulates the work of the thread. const work_time = 3 * ((5 - num % 3) - 2); - std.time.sleep(work_time * std.time.ns_per_s); + std.Thread.sleep(work_time * std.time.ns_per_s); std.debug.print("thread {d}: {s}\n", .{ num, "finished." }); } From 4044b93dd210cb3eb8c1993f2be0e286c4383f2f Mon Sep 17 00:00:00 2001 From: Chris Boesch Date: Tue, 22 Jul 2025 10:45:09 +0200 Subject: [PATCH 10/20] Added Readme --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a6e760f..b497666 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,8 @@ that if you update one, you may need to also update the other. ### Version Changes -Version-0.14.0-dev.1573 +Version-0.15.0-dev.1092 +* *2025-07-22* zig 0.15.0-dev.1092 - various changes due to new I/O API, see [#24488](https://github.com/ziglang/zig/pull/24488) * *2024-09-16* zig 0.14.0-dev.1573 - introduction of labeled switch, see [#21257](https://github.com/ziglang/zig/pull/21257) * *2024-09-02* zig 0.14.0-dev.1409 - several changes in std.builtin, see [#21225](https://github.com/ziglang/zig/pull/21225) * *2024-08-04* zig 0.14.0-dev.1224 - several changes in build system, see [#21115](https://github.com/ziglang/zig/pull/21115) From 9bff77a12a4f6eedeadbd2ad6076be4fe2c4e804 Mon Sep 17 00:00:00 2001 From: DoKoB Date: Tue, 5 Aug 2025 08:11:36 +0530 Subject: [PATCH 11/20] fix: initial zig build caused by self.step.evalZigProcess() --- build.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.zig b/build.zig index f3dd2d2..8b22a3c 100644 --- a/build.zig +++ b/build.zig @@ -519,7 +519,7 @@ const ZiglingStep = struct { // NOTE: After many changes in zig build system, we need to create the cache path manually. // See https://github.com/ziglang/zig/pull/21115 // Maybe there is a better way (in the future). - const exe_dir = try self.step.evalZigProcess(zig_args.items, prog_node, false); + const exe_dir = try self.step.evalZigProcess(zig_args.items, prog_node, false, null, b.allocator); const exe_name = switch (self.exercise.kind) { .exe => self.exercise.name(), .@"test" => "test", From fd310273a7aeecbf877057a62c3f32bc1405c926 Mon Sep 17 00:00:00 2001 From: Chris Boesch Date: Fri, 8 Aug 2025 20:34:59 +0200 Subject: [PATCH 12/20] Current version set --- README.md | 1 + build.zig | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b497666..c3fc8a0 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,7 @@ that if you update one, you may need to also update the other. ### Version Changes Version-0.15.0-dev.1092 +* *2025-08-08* zig 0.15.0-dev.1380 - changes in build system, see [#24588](https://github.com/ziglang/zig/pull/24588) * *2025-07-22* zig 0.15.0-dev.1092 - various changes due to new I/O API, see [#24488](https://github.com/ziglang/zig/pull/24488) * *2024-09-16* zig 0.14.0-dev.1573 - introduction of labeled switch, see [#21257](https://github.com/ziglang/zig/pull/21257) * *2024-09-02* zig 0.14.0-dev.1409 - several changes in std.builtin, see [#21225](https://github.com/ziglang/zig/pull/21225) diff --git a/build.zig b/build.zig index 8b22a3c..eaf4646 100644 --- a/build.zig +++ b/build.zig @@ -15,7 +15,7 @@ const print = std.debug.print; // 1) Getting Started // 2) Version Changes comptime { - const required_zig = "0.15.0-dev.1092"; + const required_zig = "0.15.0-dev.1380"; const current_zig = builtin.zig_version; const min_zig = std.SemanticVersion.parse(required_zig) catch unreachable; if (current_zig.order(min_zig) == .lt) { From 80528613c2a1d2b9685c0d8fbe2a1357ecf265d8 Mon Sep 17 00:00:00 2001 From: Chris Boesch Date: Mon, 11 Aug 2025 09:52:58 +0200 Subject: [PATCH 13/20] Fixed zig version --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c3fc8a0..7800942 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ that if you update one, you may need to also update the other. ### Version Changes -Version-0.15.0-dev.1092 +Version-0.15.0-dev.1380 * *2025-08-08* zig 0.15.0-dev.1380 - changes in build system, see [#24588](https://github.com/ziglang/zig/pull/24588) * *2025-07-22* zig 0.15.0-dev.1092 - various changes due to new I/O API, see [#24488](https://github.com/ziglang/zig/pull/24488) * *2024-09-16* zig 0.14.0-dev.1573 - introduction of labeled switch, see [#21257](https://github.com/ziglang/zig/pull/21257) From 06e56be9c5568a996815941847b3373a5f268029 Mon Sep 17 00:00:00 2001 From: Sardorbek Imomaliev Date: Mon, 11 Aug 2025 20:57:17 +0100 Subject: [PATCH 14/20] fix: 019 typo in example function, missing return type --- exercises/019_functions2.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/019_functions2.zig b/exercises/019_functions2.zig index a527ae2..5a76c7b 100644 --- a/exercises/019_functions2.zig +++ b/exercises/019_functions2.zig @@ -3,7 +3,7 @@ // example that takes two parameters. As you can see, parameters // are declared just like any other types ("name": "type"): // -// fn myFunction(number: u8, is_lucky: bool) { +// fn myFunction(number: u8, is_lucky: bool) void { // ... // } // From aeacadb76be91619417d3d13df20b25a0ca21392 Mon Sep 17 00:00:00 2001 From: Chris Boesch Date: Fri, 15 Aug 2025 15:00:53 +0200 Subject: [PATCH 15/20] Fixed changes in array list --- README.md | 1 + build.zig | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 7800942..ca2069a 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,7 @@ that if you update one, you may need to also update the other. ### Version Changes Version-0.15.0-dev.1380 +* *2025-08-08* zig 0.15.0-dev.1519 - changes in array listr, see [#24801](https://github.com/ziglang/zig/pull/24801) * *2025-08-08* zig 0.15.0-dev.1380 - changes in build system, see [#24588](https://github.com/ziglang/zig/pull/24588) * *2025-07-22* zig 0.15.0-dev.1092 - various changes due to new I/O API, see [#24488](https://github.com/ziglang/zig/pull/24488) * *2024-09-16* zig 0.14.0-dev.1573 - introduction of labeled switch, see [#21257](https://github.com/ziglang/zig/pull/21257) diff --git a/build.zig b/build.zig index eaf4646..e72dd4d 100644 --- a/build.zig +++ b/build.zig @@ -15,7 +15,7 @@ const print = std.debug.print; // 1) Getting Started // 2) Version Changes comptime { - const required_zig = "0.15.0-dev.1380"; + const required_zig = "0.15.0-dev.1519"; const current_zig = builtin.zig_version; const min_zig = std.SemanticVersion.parse(required_zig) catch unreachable; if (current_zig.order(min_zig) == .lt) { @@ -492,7 +492,7 @@ const ZiglingStep = struct { const path = join(b.allocator, &.{ self.work_path, exercise_path }) catch @panic("OOM"); - var zig_args = std.ArrayList([]const u8).init(b.allocator); + var zig_args = std.array_list.Managed([]const u8).init(b.allocator); defer zig_args.deinit(); zig_args.append(b.graph.zig_exe) catch @panic("OOM"); @@ -581,17 +581,17 @@ fn resetLine() void { /// Removes trailing whitespace for each line in buf, also ensuring that there /// are no trailing LF characters at the end. pub fn trimLines(allocator: std.mem.Allocator, buf: []const u8) ![]const u8 { - var list = try std.ArrayList(u8).initCapacity(allocator, buf.len); + var list = try std.array_list.Aligned(u8, null).initCapacity(allocator, buf.len); var iter = std.mem.splitSequence(u8, buf, " \n"); while (iter.next()) |line| { // TODO: trimming CR characters is probably not necessary. const data = std.mem.trimRight(u8, line, " \r"); - try list.appendSlice(data); - try list.append('\n'); + try list.appendSlice(allocator, data); + try list.append(allocator, '\n'); } - const result = try list.toOwnedSlice(); // TODO: probably not necessary + const result = try list.toOwnedSlice(allocator); // TODO: probably not necessary // Remove the trailing LF character, that is always present in the exercise // output. From b580f7e30ec2adf7656e2d690adc7fb187bcdfed Mon Sep 17 00:00:00 2001 From: Chris Boesch Date: Fri, 15 Aug 2025 15:03:10 +0200 Subject: [PATCH 16/20] adjusted version information --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index ca2069a..bf84593 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,6 @@ that if you update one, you may need to also update the other. ### Version Changes -Version-0.15.0-dev.1380 * *2025-08-08* zig 0.15.0-dev.1519 - changes in array listr, see [#24801](https://github.com/ziglang/zig/pull/24801) * *2025-08-08* zig 0.15.0-dev.1380 - changes in build system, see [#24588](https://github.com/ziglang/zig/pull/24588) * *2025-07-22* zig 0.15.0-dev.1092 - various changes due to new I/O API, see [#24488](https://github.com/ziglang/zig/pull/24488) From 1ca8b90589f598cd209ebab5586aa8c76773c67f Mon Sep 17 00:00:00 2001 From: Chris Boesch Date: Fri, 15 Aug 2025 15:10:47 +0200 Subject: [PATCH 17/20] fixed typo in readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bf84593..913d6b3 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ that if you update one, you may need to also update the other. ### Version Changes -* *2025-08-08* zig 0.15.0-dev.1519 - changes in array listr, see [#24801](https://github.com/ziglang/zig/pull/24801) +* *2025-08-15* zig 0.15.0-dev.1519 - changes in array list, see [#24801](https://github.com/ziglang/zig/pull/24801) * *2025-08-08* zig 0.15.0-dev.1380 - changes in build system, see [#24588](https://github.com/ziglang/zig/pull/24588) * *2025-07-22* zig 0.15.0-dev.1092 - various changes due to new I/O API, see [#24488](https://github.com/ziglang/zig/pull/24488) * *2024-09-16* zig 0.14.0-dev.1573 - introduction of labeled switch, see [#21257](https://github.com/ziglang/zig/pull/21257) From 02db8326778072c638b84293b30b55999f5ba585 Mon Sep 17 00:00:00 2001 From: "Simon 'Sze' L. Schlee" Date: Sun, 24 Aug 2025 03:08:17 +0200 Subject: [PATCH 18/20] pass -freference-trace to executed compile command Currently users executing `zig build` to run the exercises, may encounter compiler output that tells them to use `-freference-trace=[num]` to see more of the hidden reference traces, so we should pass this parameter to the zigling exercise being compiled, so that the learner can provide this parameter like they would normally, when using `zig build` directly in normal Zig programs. --- build.zig | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build.zig b/build.zig index e72dd4d..7e8bf7a 100644 --- a/build.zig +++ b/build.zig @@ -508,6 +508,10 @@ const ZiglingStep = struct { zig_args.append("-lc") catch @panic("OOM"); } + if (b.reference_trace) |rt| { + zig_args.append(b.fmt("-freference-trace={}", .{rt})) catch @panic("OOM"); + } + zig_args.append(b.pathFromRoot(path)) catch @panic("OOM"); zig_args.append("--cache-dir") catch @panic("OOM"); From 63640875699059e44a5f15b1521b17b42ef1da27 Mon Sep 17 00:00:00 2001 From: Chris Boesch <48591413+chrboesch@users.noreply.github.com> Date: Sun, 24 Aug 2025 14:42:03 +0200 Subject: [PATCH 19/20] fixed version numbers --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 913d6b3..9be565f 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ Verify the installation and build number of `zig` like so: ``` $ zig version -0.15.0-dev.xxxx+xxxxxxxxx +0.16.0-dev.xxxx+xxxxxxxxx ``` Clone this repository with Git: @@ -73,8 +73,8 @@ the appropriate tag. The Zig language is under very active development. In order to be current, Ziglings tracks **development** builds of the Zig compiler rather than versioned **release** builds. The last -stable release was `0.14.1`, but Ziglings needs a dev build with -pre-release version "0.15.0" and a build number at least as high +stable release was `0.15.1`, but Ziglings needs a dev build with +pre-release version "0.16.0" and a build number at least as high as that shown in the example version check above. It is likely that you'll download a build which is _greater_ than From 16ec20747190fa0d02ca8872cebbba4e0581b08d Mon Sep 17 00:00:00 2001 From: Chris Boesch <48591413+chrboesch@users.noreply.github.com> Date: Sun, 24 Aug 2025 14:50:42 +0200 Subject: [PATCH 20/20] fixed typo and broken link --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 9be565f..fd45a06 100644 --- a/README.md +++ b/README.md @@ -25,10 +25,9 @@ language such as C. Each exercise is self-contained and self-explained. However, you're encouraged to also check out these Zig language resources -for more detail: +for more details: * https://ziglang.org/learn/ -* https://ziglearn.org/ * https://ziglang.org/documentation/master/ * [Zig in Depth! (video series)](https://www.youtube.com/watch?v=MMtvGA1YhW4&list=PLtB7CL7EG7pCw7Xy1SQC53Gl8pI7aDg9t&pp=iAQB)