commit 8dae629c4f89155b6945ee952ee2aeb5bfa1d271 (tree)
parent 529df8c0075a1a91860523ed33c475473d332ae3
Author: Andrew Kelley <andrew@ziglang.org>
Date: Mon, 5 Aug 2024 19:19:10 -0700
update branch for latest std.sort changes
Diffstat:
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/lib/std/Build/Fuzz/WebServer.zig b/lib/std/Build/Fuzz/WebServer.zig
@@ -649,7 +649,11 @@ fn addEntryPoint(ws: *WebServer, coverage_id: u64, addr: u64) error{ AlreadyRepo
const ptr = coverage_map.mapped_memory;
const pcs_bytes = ptr[@sizeOf(abi.SeenPcsHeader)..][0 .. coverage_map.source_locations.len * @sizeOf(usize)];
const pcs: []const usize = @alignCast(std.mem.bytesAsSlice(usize, pcs_bytes));
- const index = std.sort.upperBound(usize, addr, pcs, {}, std.sort.asc(usize));
+ const index = std.sort.upperBound(usize, pcs, addr, struct {
+ fn order(context: usize, item: usize) std.math.Order {
+ return std.math.order(item, context);
+ }
+ }.order);
if (index >= pcs.len) {
log.err("unable to find unit test entry address 0x{x} in source locations (range: 0x{x} to 0x{x})", .{
addr, pcs[0], pcs[pcs.len - 1],
diff --git a/lib/std/debug/Dwarf.zig b/lib/std/debug/Dwarf.zig
@@ -157,7 +157,11 @@ pub const CompileUnit = struct {
};
pub fn findSource(slc: *const SrcLocCache, address: u64) !LineEntry {
- const index = std.sort.upperBound(u64, address, slc.line_table.keys(), {}, std.sort.asc(u64));
+ const index = std.sort.upperBound(u64, slc.line_table.keys(), address, struct {
+ fn order(context: u64, item: u64) std.math.Order {
+ return std.math.order(item, context);
+ }
+ }.order);
if (index == 0) return missing();
return slc.line_table.values()[index - 1];
}