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 /test/behavior/array.zig | |
| 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 'test/behavior/array.zig')
| -rw-r--r-- | test/behavior/array.zig | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/test/behavior/array.zig b/test/behavior/array.zig index 9ef4a55b39..bc8176aa9c 100644 --- a/test/behavior/array.zig +++ b/test/behavior/array.zig @@ -170,7 +170,7 @@ test "array with sentinels" { { var zero_sized: [0:0xde]u8 = [_:0xde]u8{}; try expect(zero_sized[0] == 0xde); - var reinterpreted = @ptrCast(*[1]u8, &zero_sized); + var reinterpreted = @as(*[1]u8, @ptrCast(&zero_sized)); try expect(reinterpreted[0] == 0xde); } var arr: [3:0x55]u8 = undefined; @@ -694,7 +694,7 @@ test "array init of container level array variable" { test "runtime initialized sentinel-terminated array literal" { var c: u16 = 300; const f = &[_:0x9999]u16{c}; - const g = @ptrCast(*const [4]u8, f); + const g = @as(*const [4]u8, @ptrCast(f)); try std.testing.expect(g[2] == 0x99); try std.testing.expect(g[3] == 0x99); } |
