| ... | @@ -110,6 +110,7 @@ pub fn create(self: Allocator, comptime T: type) Error!*T { | ... | @@ -110,6 +110,7 @@ pub fn create(self: Allocator, comptime T: type) Error!*T { |
| 110 | /// have the same address and alignment property. | 110 | /// have the same address and alignment property. |
| 111 | pub fn destroy(self: Allocator, ptr: anytype) void { | 111 | pub fn destroy(self: Allocator, ptr: anytype) void { |
| 112 | const info = @typeInfo(@TypeOf(ptr)).Pointer; | 112 | const info = @typeInfo(@TypeOf(ptr)).Pointer; |
| | 113 | if (info.size != .One) @compileError("ptr must be a single item pointer"); |
| 113 | const T = info.child; | 114 | const T = info.child; |
| 114 | if (@sizeOf(T) == 0) return; | 115 | if (@sizeOf(T) == 0) return; |
| 115 | const non_const_ptr = @as([*]u8, @ptrCast(@constCast(ptr))); | 116 | const non_const_ptr = @as([*]u8, @ptrCast(@constCast(ptr))); |