diff options
| author | mlugg <mlugg@mlugg.co.uk> | 2023-06-22 18:46:56 +0100 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2023-06-24 16:56:39 -0700 |
| commit | f26dda21171e26f44aeec8c59a75bbb3331eeb2e (patch) | |
| tree | c935248861ae2693b314f2c8bc78fe38d9961b6d /lib/std/testing | |
| parent | 447ca4e3fff021f471b748187b53f0a4744ad0bc (diff) | |
| download | zig-f26dda21171e26f44aeec8c59a75bbb3331eeb2e.tar.gz zig-f26dda21171e26f44aeec8c59a75bbb3331eeb2e.zip | |
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
Diffstat (limited to 'lib/std/testing')
| -rw-r--r-- | lib/std/testing/failing_allocator.zig | 6 |
1 files changed, 3 insertions, 3 deletions
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; |
