| author | |
| committer | |
| log | a83fb9289fe82a0e4f5c228342e79d559af69bc3 |
| tree | 71b4c0c745d107421cc60a23431292a175d4c1e9 |
| parent | e24dcd2707b5956cd53d4b38dc3ac6be0cf0a264 |
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.1 files changed, 1 insertions(+), 1 deletions(-)
lib/std/bounded_array.zig+1-1| ... | ... | @@ -34,7 +34,7 @@ pub fn BoundedArray(comptime T: type, comptime capacity: usize) type { |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | /// View the internal array as a constant slice whose size was previously set. |
| 37 | pub fn constSlice(self: Self) []const T { | |
| 37 | pub fn constSlice(self: *const Self) []const T { | |
| 38 | 38 | return self.buffer[0..self.len]; |
| 39 | 39 | } |
| 40 | 40 |