aboutsummaryrefslogtreecommitdiff
path: root/lib/std/Build.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2024-07-20 13:04:49 -0700
committerGitHub <noreply@github.com>2024-07-20 13:04:49 -0700
commitb5f3d121644031cf644271296e1ee5dbf363abeb (patch)
tree1a6aa7a7ca974b2d5e24bddf6e2f3b9f7c0040c6 /lib/std/Build.zig
parentef3a746da1a85a8b4a653cb78e0464c71d35b64e (diff)
parent645ad1ef72a09785fe5d7b33f1f9f2394bf52f57 (diff)
downloadzig-b5f3d121644031cf644271296e1ee5dbf363abeb.tar.gz
zig-b5f3d121644031cf644271296e1ee5dbf363abeb.zip
Merge pull request #20688 from ziglang/incr-test
introduce a new tool for testing incremental compilation
Diffstat (limited to 'lib/std/Build.zig')
-rw-r--r--lib/std/Build.zig15
1 files changed, 3 insertions, 12 deletions
diff --git a/lib/std/Build.zig b/lib/std/Build.zig
index 06de7aa6f4..c68170b2c1 100644
--- a/lib/std/Build.zig
+++ b/lib/std/Build.zig
@@ -2522,7 +2522,7 @@ pub const InstallDir = union(enum) {
/// function.
pub fn makeTempPath(b: *Build) []const u8 {
const rand_int = std.crypto.random.int(u64);
- const tmp_dir_sub_path = "tmp" ++ fs.path.sep_str ++ hex64(rand_int);
+ const tmp_dir_sub_path = "tmp" ++ fs.path.sep_str ++ std.fmt.hex(rand_int);
const result_path = b.cache_root.join(b.allocator, &.{tmp_dir_sub_path}) catch @panic("OOM");
b.cache_root.handle.makePath(tmp_dir_sub_path) catch |err| {
std.debug.print("unable to make tmp path '{s}': {s}\n", .{
@@ -2532,18 +2532,9 @@ pub fn makeTempPath(b: *Build) []const u8 {
return result_path;
}
-/// There are a few copies of this function in miscellaneous places. Would be nice to find
-/// a home for them.
+/// Deprecated; use `std.fmt.hex` instead.
pub fn hex64(x: u64) [16]u8 {
- const hex_charset = "0123456789abcdef";
- var result: [16]u8 = undefined;
- var i: usize = 0;
- while (i < 8) : (i += 1) {
- const byte: u8 = @truncate(x >> @as(u6, @intCast(8 * i)));
- result[i * 2 + 0] = hex_charset[byte >> 4];
- result[i * 2 + 1] = hex_charset[byte & 15];
- }
- return result;
+ return std.fmt.hex(x);
}
/// A pair of target query and fully resolved target.