zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit d828115dabf3b06711788dc2f424a1ef3cedd6a3 (tree)
parent d54fbc01234688b37a48b29fee499529a500ccf5
Author: Andrew Kelley <andrew@ziglang.org>
Date:   Fri, 21 Nov 2025 19:56:15 -0800

Merge pull request #25903 from aznashwan/minor-docs-fixes

docs: minor fixes to main language reference page.
Diffstat:
Mdoc/langref.html.in | 3+--
Mdoc/langref/values.zig | 7++++++-
2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/doc/langref.html.in b/doc/langref.html.in @@ -421,8 +421,7 @@ {#code|unattached_doc-comment.zig#} <p> - Doc comments can be interleaved with normal comments. Currently, when producing - the package documentation, normal comments are merged with doc comments. + Doc comments can be interleaved with normal comments, which are ignored. </p> {#header_close#} {#header_open|Top-Level Doc Comments#} diff --git a/doc/langref/values.zig b/doc/langref/values.zig @@ -4,6 +4,11 @@ const std = @import("std"); const os = std.os; const assert = std.debug.assert; +// Custom error set definition: +const ExampleErrorSet = error{ + ExampleErrorVariant, +}; + pub fn main() void { // integers const one_plus_one: i32 = 1 + 1; @@ -36,7 +41,7 @@ pub fn main() void { }); // error union - var number_or_error: anyerror!i32 = error.ArgNotFound; + var number_or_error: ExampleErrorSet!i32 = ExampleErrorSet.ExampleErrorVariant; print("\nerror union 1\ntype: {}\nvalue: {!}\n", .{ @TypeOf(number_or_error),