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

docs: minor fixes to main language reference page.
This commit is contained in:
Andrew Kelley 2025-11-21 19:56:15 -08:00 committed by GitHub
commit d828115dab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 3 deletions

View File

@ -421,8 +421,7 @@
{#code|unattached_doc-comment.zig#} {#code|unattached_doc-comment.zig#}
<p> <p>
Doc comments can be interleaved with normal comments. Currently, when producing Doc comments can be interleaved with normal comments, which are ignored.
the package documentation, normal comments are merged with doc comments.
</p> </p>
{#header_close#} {#header_close#}
{#header_open|Top-Level Doc Comments#} {#header_open|Top-Level Doc Comments#}

View File

@ -4,6 +4,11 @@ const std = @import("std");
const os = std.os; const os = std.os;
const assert = std.debug.assert; const assert = std.debug.assert;
// Custom error set definition:
const ExampleErrorSet = error{
ExampleErrorVariant,
};
pub fn main() void { pub fn main() void {
// integers // integers
const one_plus_one: i32 = 1 + 1; const one_plus_one: i32 = 1 + 1;
@ -36,7 +41,7 @@ pub fn main() void {
}); });
// error union // 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", .{ print("\nerror union 1\ntype: {}\nvalue: {!}\n", .{
@TypeOf(number_or_error), @TypeOf(number_or_error),