| author | |
| committer | |
| log | b6b3462796fe38a071e6ed2cbcdbb5b024359f35 |
| tree | a27dc4a4b577c70aa478dedc0704ef5404e4423a |
| parent | 11c64bfe6ec921a481b340392ab1d2377359586d |
Closes #135172 files changed, 2 insertions(+), 2 deletions(-)
lib/std/mem/Allocator.zig+1-1| ... | ... | @@ -167,7 +167,7 @@ pub inline fn rawFree(self: Allocator, buf: []u8, buf_align: u29, ret_addr: usiz |
| 167 | 167 | /// Returns a pointer to undefined memory. |
| 168 | 168 | /// Call `destroy` with the result to free the memory. |
| 169 | 169 | pub fn create(self: Allocator, comptime T: type) Error!*T { |
| 170 | if (@sizeOf(T) == 0) return @as(*T, undefined); | |
| 170 | if (@sizeOf(T) == 0) return @intToPtr(*T, std.math.maxInt(usize)); | |
| 171 | 171 | const slice = try self.allocAdvancedWithRetAddr(T, null, 1, .exact, @returnAddress()); |
| 172 | 172 | return &slice[0]; |
| 173 | 173 | } |
src/Sema.zig+1-1| ... | ... | @@ -18754,7 +18754,7 @@ fn zirIntToPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 18754 | 18754 | const addr = val.toUnsignedInt(target); |
| 18755 | 18755 | if (!ptr_ty.isAllowzeroPtr() and addr == 0) |
| 18756 | 18756 | return sema.fail(block, operand_src, "pointer type '{}' does not allow address zero", .{ptr_ty.fmt(sema.mod)}); |
| 18757 | if (addr != 0 and addr % ptr_align != 0) | |
| 18757 | if (addr != 0 and ptr_align != 0 and addr % ptr_align != 0) | |
| 18758 | 18758 | return sema.fail(block, operand_src, "pointer type '{}' requires aligned address", .{ptr_ty.fmt(sema.mod)}); |
| 18759 | 18759 | |
| 18760 | 18760 | const val_payload = try sema.arena.create(Value.Payload.U64); |