authorgravatar for 51252236+xdBronch@users.noreply.github.comxdBronch <51252236+xdBronch@users.noreply.github.com> 2023-07-06 13:43:50-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-07-10 10:52:27-07:00
logd7c6cfa7fdf51f0b52aa3666aaa3022bd8e4876f
treef6d74813a9f5f16ff0264ce5e17c4366cbdb8a53
parent0b1e8690dadb5d81b4d63832e27a117f57b4be81

std.mem.zeroes work with allowzero pointers


1 files changed, 2 insertions(+), 1 deletions(-)

lib/std/mem.zig+2-1
...@@ -276,7 +276,8 @@ pub fn zeroes(comptime T: type) T {...@@ -276,7 +276,8 @@ pub fn zeroes(comptime T: type) T {
276 return null;276 return null;
277 },277 },
278 .One, .Many => {278 .One, .Many => {
279 @compileError("Can't set a non nullable pointer to zero.");279 if (ptr_info.is_allowzero) return @ptrFromInt(0);
280 @compileError("Only nullable and allowzero pointers can be set to zero.");
280 },281 },
281 }282 }
282 },283 },