From f26dda21171e26f44aeec8c59a75bbb3331eeb2e Mon Sep 17 00:00:00 2001 From: mlugg Date: Thu, 22 Jun 2023 18:46:56 +0100 Subject: all: migrate code to new cast builtin syntax Most of this migration was performed automatically with `zig fmt`. There were a few exceptions which I had to manually fix: * `@alignCast` and `@addrSpaceCast` cannot be automatically rewritten * `@truncate`'s fixup is incorrect for vectors * Test cases are not formatted, and their error locations change --- lib/std/testing/failing_allocator.zig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/std/testing') diff --git a/lib/std/testing/failing_allocator.zig b/lib/std/testing/failing_allocator.zig index 2cdb78cd1d..313af987ab 100644 --- a/lib/std/testing/failing_allocator.zig +++ b/lib/std/testing/failing_allocator.zig @@ -63,7 +63,7 @@ pub const FailingAllocator = struct { log2_ptr_align: u8, return_address: usize, ) ?[*]u8 { - const self = @ptrCast(*FailingAllocator, @alignCast(@alignOf(FailingAllocator), ctx)); + const self: *FailingAllocator = @ptrCast(@alignCast(ctx)); if (self.index == self.fail_index) { if (!self.has_induced_failure) { @memset(&self.stack_addresses, 0); @@ -91,7 +91,7 @@ pub const FailingAllocator = struct { new_len: usize, ra: usize, ) bool { - const self = @ptrCast(*FailingAllocator, @alignCast(@alignOf(FailingAllocator), ctx)); + const self: *FailingAllocator = @ptrCast(@alignCast(ctx)); if (!self.internal_allocator.rawResize(old_mem, log2_old_align, new_len, ra)) return false; if (new_len < old_mem.len) { @@ -108,7 +108,7 @@ pub const FailingAllocator = struct { log2_old_align: u8, ra: usize, ) void { - const self = @ptrCast(*FailingAllocator, @alignCast(@alignOf(FailingAllocator), ctx)); + const self: *FailingAllocator = @ptrCast(@alignCast(ctx)); self.internal_allocator.rawFree(old_mem, log2_old_align, ra); self.deallocations += 1; self.freed_bytes += old_mem.len; -- cgit v1.2.3