aboutsummaryrefslogtreecommitdiff
path: root/lib/std/testing
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-06-24 16:58:19 -0700
committerGitHub <noreply@github.com>2023-06-24 16:58:19 -0700
commit146b79af153bbd5dafda0ba12a040385c7fc58f8 (patch)
tree67e3db8b444d65c667e314770fc983a7fc8ba293 /lib/std/testing
parent13853bef0df3c90633021850cc6d6abaeea03282 (diff)
parent21ac0beb436f49fe49c6982a872f2dc48e4bea5e (diff)
downloadzig-146b79af153bbd5dafda0ba12a040385c7fc58f8.tar.gz
zig-146b79af153bbd5dafda0ba12a040385c7fc58f8.zip
Merge pull request #16163 from mlugg/feat/builtins-infer-dest-ty
Infer destination type of cast builtins using result type
Diffstat (limited to 'lib/std/testing')
-rw-r--r--lib/std/testing/failing_allocator.zig6
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;