std.mem.zeroes work with allowzero pointers

This commit is contained in:
xdBronch 2023-07-06 13:43:50 -04:00 committed by Andrew Kelley
parent 0b1e8690da
commit d7c6cfa7fd

View File

@ -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.");
},
}
},