aboutsummaryrefslogtreecommitdiff
path: root/src/Manifest.zig
diff options
context:
space:
mode:
authormlugg <mlugg@mlugg.co.uk>2023-06-22 18:46:56 +0100
committerAndrew Kelley <andrew@ziglang.org>2023-06-24 16:56:39 -0700
commitf26dda21171e26f44aeec8c59a75bbb3331eeb2e (patch)
treec935248861ae2693b314f2c8bc78fe38d9961b6d /src/Manifest.zig
parent447ca4e3fff021f471b748187b53f0a4744ad0bc (diff)
downloadzig-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 'src/Manifest.zig')
-rw-r--r--src/Manifest.zig22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/Manifest.zig b/src/Manifest.zig
index 0549287e60..199663556d 100644
--- a/src/Manifest.zig
+++ b/src/Manifest.zig
@@ -102,7 +102,7 @@ pub fn hex64(x: u64) [16]u8 {
var result: [16]u8 = undefined;
var i: usize = 0;
while (i < 8) : (i += 1) {
- const byte = @truncate(u8, x >> @intCast(u6, 8 * i));
+ const byte = @as(u8, @truncate(x >> @as(u6, @intCast(8 * i))));
result[i * 2 + 0] = hex_charset[byte >> 4];
result[i * 2 + 1] = hex_charset[byte & 15];
}
@@ -284,7 +284,7 @@ const Parse = struct {
@errorName(err),
});
};
- if (@enumFromInt(MultihashFunction, their_multihash_func) != multihash_function) {
+ if (@as(MultihashFunction, @enumFromInt(their_multihash_func)) != multihash_function) {
return fail(p, tok, "unsupported hash function: only sha2-256 is supported", .{});
}
}
@@ -345,7 +345,7 @@ const Parse = struct {
.invalid_escape_character => |bad_index| {
try p.appendErrorOff(
token,
- offset + @intCast(u32, bad_index),
+ offset + @as(u32, @intCast(bad_index)),
"invalid escape character: '{c}'",
.{raw_string[bad_index]},
);
@@ -353,7 +353,7 @@ const Parse = struct {
.expected_hex_digit => |bad_index| {
try p.appendErrorOff(
token,
- offset + @intCast(u32, bad_index),
+ offset + @as(u32, @intCast(bad_index)),
"expected hex digit, found '{c}'",
.{raw_string[bad_index]},
);
@@ -361,7 +361,7 @@ const Parse = struct {
.empty_unicode_escape_sequence => |bad_index| {
try p.appendErrorOff(
token,
- offset + @intCast(u32, bad_index),
+ offset + @as(u32, @intCast(bad_index)),
"empty unicode escape sequence",
.{},
);
@@ -369,7 +369,7 @@ const Parse = struct {
.expected_hex_digit_or_rbrace => |bad_index| {
try p.appendErrorOff(
token,
- offset + @intCast(u32, bad_index),
+ offset + @as(u32, @intCast(bad_index)),
"expected hex digit or '}}', found '{c}'",
.{raw_string[bad_index]},
);
@@ -377,7 +377,7 @@ const Parse = struct {
.invalid_unicode_codepoint => |bad_index| {
try p.appendErrorOff(
token,
- offset + @intCast(u32, bad_index),
+ offset + @as(u32, @intCast(bad_index)),
"unicode escape does not correspond to a valid codepoint",
.{},
);
@@ -385,7 +385,7 @@ const Parse = struct {
.expected_lbrace => |bad_index| {
try p.appendErrorOff(
token,
- offset + @intCast(u32, bad_index),
+ offset + @as(u32, @intCast(bad_index)),
"expected '{{', found '{c}",
.{raw_string[bad_index]},
);
@@ -393,7 +393,7 @@ const Parse = struct {
.expected_rbrace => |bad_index| {
try p.appendErrorOff(
token,
- offset + @intCast(u32, bad_index),
+ offset + @as(u32, @intCast(bad_index)),
"expected '}}', found '{c}",
.{raw_string[bad_index]},
);
@@ -401,7 +401,7 @@ const Parse = struct {
.expected_single_quote => |bad_index| {
try p.appendErrorOff(
token,
- offset + @intCast(u32, bad_index),
+ offset + @as(u32, @intCast(bad_index)),
"expected single quote ('), found '{c}",
.{raw_string[bad_index]},
);
@@ -409,7 +409,7 @@ const Parse = struct {
.invalid_character => |bad_index| {
try p.appendErrorOff(
token,
- offset + @intCast(u32, bad_index),
+ offset + @as(u32, @intCast(bad_index)),
"invalid byte in string or character literal: '{c}'",
.{raw_string[bad_index]},
);