Commit d7c6cfa7fd

xdBronch <51252236+xdBronch@users.noreply.github.com>
2023-07-06 19:43:50
std.mem.zeroes work with allowzero pointers
1 parent 0b1e869
Changed files (1)
lib
lib/std/mem.zig
@@ -276,7 +276,8 @@ pub fn zeroes(comptime T: type) T {
                     return null;
                 },
                 .One, .Many => {
-                    @compileError("Can't set a non nullable pointer to zero.");
+                    if (ptr_info.is_allowzero) return @ptrFromInt(0);
+                    @compileError("Only nullable and allowzero pointers can be set to zero.");
                 },
             }
         },