aboutsummaryrefslogtreecommitdiff
path: root/lib/std/bounded_array.zig
diff options
context:
space:
mode:
authorRohlem <rohlemF@gmail.com>2021-11-19 12:08:28 +0100
committerAndrew Kelley <andrew@ziglang.org>2021-11-20 02:35:36 -0500
commita83fb9289fe82a0e4f5c228342e79d559af69bc3 (patch)
tree71b4c0c745d107421cc60a23431292a175d4c1e9 /lib/std/bounded_array.zig
parente24dcd2707b5956cd53d4b38dc3ac6be0cf0a264 (diff)
downloadzig-a83fb9289fe82a0e4f5c228342e79d559af69bc3.tar.gz
zig-a83fb9289fe82a0e4f5c228342e79d559af69bc3.zip
std.bounded_array: fix `self` parameter type in `constSlice`
Because `.buffer` is an inline array field, we actually require `self` to be passed as a pointer. If the compiler decided to pass the object by copying, we would return a pointer to to-be-destroyed stack memory.
Diffstat (limited to 'lib/std/bounded_array.zig')
-rw-r--r--lib/std/bounded_array.zig2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/std/bounded_array.zig b/lib/std/bounded_array.zig
index 18328683ae..51a4488387 100644
--- a/lib/std/bounded_array.zig
+++ b/lib/std/bounded_array.zig
@@ -34,7 +34,7 @@ pub fn BoundedArray(comptime T: type, comptime capacity: usize) type {
}
/// View the internal array as a constant slice whose size was previously set.
- pub fn constSlice(self: Self) []const T {
+ pub fn constSlice(self: *const Self) []const T {
return self.buffer[0..self.len];
}