aboutsummaryrefslogtreecommitdiff
path: root/lib/std/Build
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-04-29 00:19:55 -0700
committerGitHub <noreply@github.com>2023-04-29 00:19:55 -0700
commitd65b42e07caa00dfe2f2fbf221c593ce57882784 (patch)
tree7926cbea1499e0affe930bf6d7455dc24adf014e /lib/std/Build
parentfd6200eda6d4fe19c34a59430a88a9ce38d6d7a4 (diff)
parentfa200ca0cad2705bad40eb723dedf4e3bf11f2ff (diff)
downloadzig-d65b42e07caa00dfe2f2fbf221c593ce57882784.tar.gz
zig-d65b42e07caa00dfe2f2fbf221c593ce57882784.zip
Merge pull request #15481 from ziglang/use-mem-intrinsics
actually use the new memory intrinsics
Diffstat (limited to 'lib/std/Build')
-rw-r--r--lib/std/Build/Cache.zig2
-rw-r--r--lib/std/Build/CompileStep.zig2
-rw-r--r--lib/std/Build/RunStep.zig19
3 files changed, 18 insertions, 5 deletions
diff --git a/lib/std/Build/Cache.zig b/lib/std/Build/Cache.zig
index cae779a306..9139311785 100644
--- a/lib/std/Build/Cache.zig
+++ b/lib/std/Build/Cache.zig
@@ -388,7 +388,7 @@ pub const Manifest = struct {
self.hash.hasher = hasher_init;
self.hash.hasher.update(&bin_digest);
- mem.copy(u8, &manifest_file_path, &self.hex_digest);
+ @memcpy(manifest_file_path[0..self.hex_digest.len], &self.hex_digest);
manifest_file_path[hex_digest_len..][0..ext.len].* = ext.*;
if (self.files.items.len == 0) {
diff --git a/lib/std/Build/CompileStep.zig b/lib/std/Build/CompileStep.zig
index b71298ce6a..d5a135e24b 100644
--- a/lib/std/Build/CompileStep.zig
+++ b/lib/std/Build/CompileStep.zig
@@ -1139,7 +1139,7 @@ fn appendModuleArgs(
// We'll use this buffer to store the name we decide on
var buf = try b.allocator.alloc(u8, dep.name.len + 32);
// First, try just the exposed dependency name
- std.mem.copy(u8, buf, dep.name);
+ @memcpy(buf[0..dep.name.len], dep.name);
var name = buf[0..dep.name.len];
var n: usize = 0;
while (names.contains(name)) {
diff --git a/lib/std/Build/RunStep.zig b/lib/std/Build/RunStep.zig
index 435c7369d0..ce2dd0234a 100644
--- a/lib/std/Build/RunStep.zig
+++ b/lib/std/Build/RunStep.zig
@@ -822,9 +822,19 @@ fn runCommand(
},
},
.zig_test => {
+ const prefix: []const u8 = p: {
+ if (result.stdio.test_metadata) |tm| {
+ if (tm.next_index <= tm.names.len) {
+ const name = tm.testName(tm.next_index - 1);
+ break :p b.fmt("while executing test '{s}', ", .{name});
+ }
+ }
+ break :p "";
+ };
const expected_term: std.process.Child.Term = .{ .Exited = 0 };
if (!termMatches(expected_term, result.term)) {
- return step.fail("the following command {} (expected {}):\n{s}", .{
+ return step.fail("{s}the following command {} (expected {}):\n{s}", .{
+ prefix,
fmtTerm(result.term),
fmtTerm(expected_term),
try Step.allocPrintCmd(arena, self.cwd, final_argv),
@@ -832,8 +842,8 @@ fn runCommand(
}
if (!result.stdio.test_results.isSuccess()) {
return step.fail(
- "the following test command failed:\n{s}",
- .{try Step.allocPrintCmd(arena, self.cwd, final_argv)},
+ "{s}the following test command failed:\n{s}",
+ .{ prefix, try Step.allocPrintCmd(arena, self.cwd, final_argv) },
);
}
},
@@ -922,6 +932,7 @@ const StdIoResult = struct {
stdout_null: bool,
stderr_null: bool,
test_results: Step.TestResults,
+ test_metadata: ?TestMetadata,
};
fn evalZigTest(
@@ -1057,6 +1068,7 @@ fn evalZigTest(
.skip_count = skip_count,
.leak_count = leak_count,
},
+ .test_metadata = metadata,
};
}
@@ -1172,6 +1184,7 @@ fn evalGeneric(self: *RunStep, child: *std.process.Child) !StdIoResult {
.stdout_null = stdout_null,
.stderr_null = stderr_null,
.test_results = .{},
+ .test_metadata = null,
};
}