diff options
| author | Cassidy Dingenskirchen <admin@15318.de> | 2020-06-12 16:32:02 +0200 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-06-12 13:33:31 -0400 |
| commit | 57f1ed5325eeb3c3ca62af62a104f840881248f0 (patch) | |
| tree | e4d51ad2253abd16d569f0abc160d883512c43e5 /lib/std | |
| parent | 7d8fd452672e1fcf3692da0f52d480415b67e1ea (diff) | |
| download | zig-57f1ed5325eeb3c3ca62af62a104f840881248f0.tar.gz zig-57f1ed5325eeb3c3ca62af62a104f840881248f0.zip | |
Fix a few std.sort.sort invocations
Diffstat (limited to 'lib/std')
| -rw-r--r-- | lib/std/build/emit_raw.zig | 8 | ||||
| -rw-r--r-- | lib/std/meta.zig | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/lib/std/build/emit_raw.zig b/lib/std/build/emit_raw.zig index 30174a9af4..8fd27d6cfc 100644 --- a/lib/std/build/emit_raw.zig +++ b/lib/std/build/emit_raw.zig @@ -92,7 +92,7 @@ const BinaryElfOutput = struct { } } - sort.sort(*BinaryElfSegment, self.segments.span(), segmentSortCompare); + sort.sort(*BinaryElfSegment, self.segments.span(), {}, segmentSortCompare); if (self.segments.items.len > 0) { const firstSegment = self.segments.items[0]; @@ -117,7 +117,7 @@ const BinaryElfOutput = struct { } } - sort.sort(*BinaryElfSection, self.sections.span(), sectionSortCompare); + sort.sort(*BinaryElfSection, self.sections.span(), {}, sectionSortCompare); return self; } @@ -131,7 +131,7 @@ const BinaryElfOutput = struct { ((shdr.sh_flags & elf.SHF_ALLOC) == elf.SHF_ALLOC); } - fn segmentSortCompare(left: *BinaryElfSegment, right: *BinaryElfSegment) bool { + fn segmentSortCompare(context: void, left: *BinaryElfSegment, right: *BinaryElfSegment) bool { if (left.physicalAddress < right.physicalAddress) { return true; } @@ -141,7 +141,7 @@ const BinaryElfOutput = struct { return false; } - fn sectionSortCompare(left: *BinaryElfSection, right: *BinaryElfSection) bool { + fn sectionSortCompare(context: void, left: *BinaryElfSection, right: *BinaryElfSection) bool { return left.binaryOffset < right.binaryOffset; } }; diff --git a/lib/std/meta.zig b/lib/std/meta.zig index f5c4ab59fd..75f507da74 100644 --- a/lib/std/meta.zig +++ b/lib/std/meta.zig @@ -145,8 +145,8 @@ test "std.meta.Child" { /// Given a "memory span" type, returns the "element type". pub fn Elem(comptime T: type) type { switch (@typeInfo(T)) { - .Array, => |info| return info.child, - .Vector, => |info| return info.child, + .Array => |info| return info.child, + .Vector => |info| return info.child, .Pointer => |info| switch (info.size) { .One => switch (@typeInfo(info.child)) { .Array => |array_info| return array_info.child, @@ -658,7 +658,7 @@ pub fn refAllDecls(comptime T: type) void { /// Returns a slice of pointers to public declarations of a namespace. pub fn declList(comptime Namespace: type, comptime Decl: type) []const *const Decl { const S = struct { - fn declNameLessThan(lhs: *const Decl, rhs: *const Decl) bool { + fn declNameLessThan(context: void, lhs: *const Decl, rhs: *const Decl) bool { return mem.lessThan(u8, lhs.name, rhs.name); } }; @@ -668,7 +668,7 @@ pub fn declList(comptime Namespace: type, comptime Decl: type) []const *const De for (decls) |decl, i| { array[i] = &@field(Namespace, decl.name); } - std.sort.sort(*const Decl, &array, S.declNameLessThan); + std.sort.sort(*const Decl, &array, {}, S.declNameLessThan); return &array; } } |
