authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-07-16 18:32:52-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-07-16 18:32:52-07:00
loga576082170b66087f92c09cc1c7315d43e04b39c
treefc06b0a9db536e3127d95d93b7fc30f71c52ecd9
parentc6aa29b6fdba1606bfd218b17de89f64179c0ed8

std: reword some comments


2 files changed, 4 insertions(+), 5 deletions(-)

lib/std/array_hash_map.zig+1-1
...@@ -728,7 +728,7 @@ pub fn ArrayHashMapUnmanaged(...@@ -728,7 +728,7 @@ pub fn ArrayHashMapUnmanaged(
728 }728 }
729729
730 const index = self.entries.addOneAssumeCapacity();730 const index = self.entries.addOneAssumeCapacity();
731 // unsafe indexing because the length changed731 // The slice length changed, so we directly index the pointer.
732 if (store_hash) hashes_array.ptr[index] = h;732 if (store_hash) hashes_array.ptr[index] = h;
733733
734 return GetOrPutResult{734 return GetOrPutResult{
lib/std/array_list.zig+3-4
...@@ -501,8 +501,7 @@ pub fn ArrayListAligned(comptime T: type, comptime alignment: ?u29) type {...@@ -501,8 +501,7 @@ pub fn ArrayListAligned(comptime T: type, comptime alignment: ?u29) type {
501 /// Returns a slice of all the items plus the extra capacity, whose memory501 /// Returns a slice of all the items plus the extra capacity, whose memory
502 /// contents are `undefined`.502 /// contents are `undefined`.
503 pub fn allocatedSlice(self: Self) Slice {503 pub fn allocatedSlice(self: Self) Slice {
504 // For a nicer API, `items.len` is the length, not the capacity.504 // `items.len` is the length, not the capacity.
505 // This requires "unsafe" slicing.
506 return self.items.ptr[0..self.capacity];505 return self.items.ptr[0..self.capacity];
507 }506 }
508507
...@@ -1010,8 +1009,8 @@ pub fn ArrayListAlignedUnmanaged(comptime T: type, comptime alignment: ?u29) typ...@@ -1010,8 +1009,8 @@ pub fn ArrayListAlignedUnmanaged(comptime T: type, comptime alignment: ?u29) typ
1010 return self.pop();1009 return self.pop();
1011 }1010 }
10121011
1013 /// For a nicer API, `items.len` is the length, not the capacity.1012 /// Returns a slice of all the items plus the extra capacity, whose memory
1014 /// This requires "unsafe" slicing.1013 /// contents are `undefined`.
1015 pub fn allocatedSlice(self: Self) Slice {1014 pub fn allocatedSlice(self: Self) Slice {
1016 return self.items.ptr[0..self.capacity];1015 return self.items.ptr[0..self.capacity];
1017 }1016 }