authorgravatar for mason@gamesbymason.comMason Remaley <mason@gamesbymason.com> 2026-07-20 00:59:31-07:00
committergravatar for mason@gamesbymason.comMason Remaley <mason@gamesbymason.com> 2026-09-26 12:35:38-07:00
loge3a0e02ef28c96b9fe02fe564a18d44f767036b9
treeebe092313c72d0dafa274d01b1205266df88e0ae
parent5f457157573edbd99c9e685892b8f81c49cf5967

Clean up doc comments


2 files changed, 14 insertions(+), 13 deletions(-)

lib/std/mem/Allocator.zig-1
...@@ -196,7 +196,6 @@ pub inline fn createAdvancedWithRetAddr(...@@ -196,7 +196,6 @@ pub inline fn createAdvancedWithRetAddr(
196 return ptr;196 return ptr;
197}197}
198198
199
200/// `ptr` should be the return value of `create`, or otherwise199/// `ptr` should be the return value of `create`, or otherwise
201/// have the same address and alignment property.200/// have the same address and alignment property.
202pub fn destroy(self: Allocator, ptr: anytype) void {201pub fn destroy(self: Allocator, ptr: anytype) void {
lib/std/zon/parse.zig+14-12
...@@ -1,11 +1,10 @@...@@ -1,11 +1,10 @@
1//! The simplest way to parse ZON at runtime is to use `fromSlice`/`fromSliceAlloc`.1//! Use `fromSlice`/`fromSliceAlloc` to parse a ZON string into a Zig value. Human readable errors
2//! are written to an out parameter.
2//!3//!
3//! Parsing from individual Zoir nodes is also available:4//! If your data is already available in tree form, consider `fromZoir`/`fromZoirAlloc`.
4//! * `fromZoir`/`fromZoirAlloc`
5//!5//!
6//! To update an existing values, see the `updateFrom*` variants. To get human readable errors, use6//! To parse into an existing value, see the `updateFrom*` variants. For lower level control over
7//! the `errors` option. For lower level control over parsing, see `std.zig.Zoir`. For importing ZON7//! parsing, see `std.zig.ZonGen`. For importing ZON at compile time, use `@import`.
8//! at compile time, use `@import`.
98
10const std = @import("std");9const std = @import("std");
11const Allocator = std.mem.Allocator;10const Allocator = std.mem.Allocator;
...@@ -91,7 +90,8 @@ pub const Error = struct {...@@ -91,7 +90,8 @@ pub const Error = struct {
91 };90 };
92};91};
9392
94/// Errors encountered while parsing ZON.93/// Errors encountered while parsing ZON. Consider logging this using the default format method to
94/// provide users with feedback on the failure.
95pub const Errors = struct {95pub const Errors = struct {
96 arena: Allocator,96 arena: Allocator,
97 list: std.ArrayList(Error),97 list: std.ArrayList(Error),
...@@ -160,9 +160,11 @@ pub fn fromSlice(T: type, options: FromSliceOptions) error{ OutOfMemory, ParseZo...@@ -160,9 +160,11 @@ pub fn fromSlice(T: type, options: FromSliceOptions) error{ OutOfMemory, ParseZo
160 });160 });
161}161}
162162
163/// Similar to `fromSlice`, but updates an existing value `current`. Fields not specified by ZON are163/// Similar to `fromSlice`, but updates `value` in place which is assumed to hold a valid value. Any
164/// left at their current values. Pointers are replaced with new values not mutated in place. On164/// unspecified fields are left unchanged.
165/// failure, values that were updated prior to the failure are left updated.165///
166/// Untagged unions and slices are replaced in their entiredy. If an error occurs while parsing,
167/// `value` remains valid but may be partially updated.
166pub fn updateFromSlice(168pub fn updateFromSlice(
167 T: type,169 T: type,
168 value: *T,170 value: *T,
...@@ -181,7 +183,7 @@ pub fn updateFromSlice(...@@ -181,7 +183,7 @@ pub fn updateFromSlice(
181pub const FromSliceAllocOptions = struct {183pub const FromSliceAllocOptions = struct {
182 /// Used for scratch allocations.184 /// Used for scratch allocations.
183 gpa: Allocator,185 gpa: Allocator,
184 /// Owns the result.186 /// Used for any allocations required by the out type.
185 arena: Allocator,187 arena: Allocator,
186 /// The ZON source to parse.188 /// The ZON source to parse.
187 source: [:0]const u8,189 source: [:0]const u8,
...@@ -303,7 +305,7 @@ pub fn updateFromZoir(...@@ -303,7 +305,7 @@ pub fn updateFromZoir(
303}305}
304306
305pub const FromZoirAllocOptions = struct {307pub const FromZoirAllocOptions = struct {
306 /// Owns the result.308 /// Used for any allocations required by the out type.
307 arena: Allocator,309 arena: Allocator,
308 /// The AST for this ZON value.310 /// The AST for this ZON value.
309 ast: *const Ast,311 ast: *const Ast,