authorgravatar for admin@15318.deCassidy Dingenskirchen <admin@15318.de> 2020-06-12 16:32:02+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-06-12 13:33:31-04:00
log57f1ed5325eeb3c3ca62af62a104f840881248f0
treee4d51ad2253abd16d569f0abc160d883512c43e5
parent7d8fd452672e1fcf3692da0f52d480415b67e1ea

Fix a few std.sort.sort invocations


5 files changed, 16 insertions(+), 16 deletions(-)

lib/std/build/emit_raw.zig+4-4
......@@ -92,7 +92,7 @@ const BinaryElfOutput = struct {
9292 }
9393 }
9494
95 sort.sort(*BinaryElfSegment, self.segments.span(), segmentSortCompare);
95 sort.sort(*BinaryElfSegment, self.segments.span(), {}, segmentSortCompare);
9696
9797 if (self.segments.items.len > 0) {
9898 const firstSegment = self.segments.items[0];
......@@ -117,7 +117,7 @@ const BinaryElfOutput = struct {
117117 }
118118 }
119119
120 sort.sort(*BinaryElfSection, self.sections.span(), sectionSortCompare);
120 sort.sort(*BinaryElfSection, self.sections.span(), {}, sectionSortCompare);
121121
122122 return self;
123123 }
......@@ -131,7 +131,7 @@ const BinaryElfOutput = struct {
131131 ((shdr.sh_flags & elf.SHF_ALLOC) == elf.SHF_ALLOC);
132132 }
133133
134 fn segmentSortCompare(left: *BinaryElfSegment, right: *BinaryElfSegment) bool {
134 fn segmentSortCompare(context: void, left: *BinaryElfSegment, right: *BinaryElfSegment) bool {
135135 if (left.physicalAddress < right.physicalAddress) {
136136 return true;
137137 }
......@@ -141,7 +141,7 @@ const BinaryElfOutput = struct {
141141 return false;
142142 }
143143
144 fn sectionSortCompare(left: *BinaryElfSection, right: *BinaryElfSection) bool {
144 fn sectionSortCompare(context: void, left: *BinaryElfSection, right: *BinaryElfSection) bool {
145145 return left.binaryOffset < right.binaryOffset;
146146 }
147147};
lib/std/meta.zig+4-4
......@@ -145,8 +145,8 @@ test "std.meta.Child" {
145145/// Given a "memory span" type, returns the "element type".
146146pub fn Elem(comptime T: type) type {
147147 switch (@typeInfo(T)) {
148 .Array, => |info| return info.child,
149 .Vector, => |info| return info.child,
148 .Array => |info| return info.child,
149 .Vector => |info| return info.child,
150150 .Pointer => |info| switch (info.size) {
151151 .One => switch (@typeInfo(info.child)) {
152152 .Array => |array_info| return array_info.child,
......@@ -658,7 +658,7 @@ pub fn refAllDecls(comptime T: type) void {
658658/// Returns a slice of pointers to public declarations of a namespace.
659659pub fn declList(comptime Namespace: type, comptime Decl: type) []const *const Decl {
660660 const S = struct {
661 fn declNameLessThan(lhs: *const Decl, rhs: *const Decl) bool {
661 fn declNameLessThan(context: void, lhs: *const Decl, rhs: *const Decl) bool {
662662 return mem.lessThan(u8, lhs.name, rhs.name);
663663 }
664664 };
......@@ -668,7 +668,7 @@ pub fn declList(comptime Namespace: type, comptime Decl: type) []const *const De
668668 for (decls) |decl, i| {
669669 array[i] = &@field(Namespace, decl.name);
670670 }
671 std.sort.sort(*const Decl, &array, S.declNameLessThan);
671 std.sort.sort(*const Decl, &array, {}, S.declNameLessThan);
672672 return &array;
673673 }
674674}
tools/process_headers.zig+2-2
......@@ -242,7 +242,7 @@ const Contents = struct {
242242 hash: []const u8,
243243 is_generic: bool,
244244
245 fn hitCountLessThan(lhs: *const Contents, rhs: *const Contents) bool {
245 fn hitCountLessThan(context: void, lhs: *const Contents, rhs: *const Contents) bool {
246246 return lhs.hit_count < rhs.hit_count;
247247 }
248248};
......@@ -414,7 +414,7 @@ pub fn main() !void {
414414 try contents_list.append(contents);
415415 }
416416 }
417 std.sort.sort(*Contents, contents_list.span(), Contents.hitCountLessThan);
417 std.sort.sort(*Contents, contents_list.span(), {}, Contents.hitCountLessThan);
418418 var best_contents = contents_list.popOrNull().?;
419419 if (best_contents.hit_count > 1) {
420420 // worth it to make it generic
tools/update_clang_options.zig+2-2
......@@ -352,7 +352,7 @@ pub fn main() anyerror!void {
352352 }
353353 // Some options have multiple matches. As an example, "-Wl,foo" matches both
354354 // "W" and "Wl,". So we sort this list in order of descending priority.
355 std.sort.sort(*json.ObjectMap, all_objects.span(), objectLessThan);
355 std.sort.sort(*json.ObjectMap, all_objects.span(), {}, objectLessThan);
356356
357357 var stdout_bos = std.io.bufferedOutStream(std.io.getStdOut().outStream());
358358 const stdout = stdout_bos.outStream();
......@@ -544,7 +544,7 @@ fn syntaxMatchesWithEql(syntax: Syntax) bool {
544544 };
545545}
546546
547fn objectLessThan(a: *json.ObjectMap, b: *json.ObjectMap) bool {
547fn objectLessThan(context: void, a: *json.ObjectMap, b: *json.ObjectMap) bool {
548548 // Priority is determined by exact matches first, followed by prefix matches in descending
549549 // length, with key as a final tiebreaker.
550550 const a_syntax = objSyntax(a);
tools/update_glibc.zig+4-4
......@@ -225,14 +225,14 @@ pub fn main() !void {
225225 var list = std.ArrayList([]const u8).init(allocator);
226226 var it = global_fn_set.iterator();
227227 while (it.next()) |kv| try list.append(kv.key);
228 std.sort.sort([]const u8, list.span(), strCmpLessThan);
228 std.sort.sort([]const u8, list.span(), {}, strCmpLessThan);
229229 break :blk list.span();
230230 };
231231 const global_ver_list = blk: {
232232 var list = std.ArrayList([]const u8).init(allocator);
233233 var it = global_ver_set.iterator();
234234 while (it.next()) |kv| try list.append(kv.key);
235 std.sort.sort([]const u8, list.span(), versionLessThan);
235 std.sort.sort([]const u8, list.span(), {}, versionLessThan);
236236 break :blk list.span();
237237 };
238238 {
......@@ -311,11 +311,11 @@ pub fn main() !void {
311311 }
312312}
313313
314pub fn strCmpLessThan(a: []const u8, b: []const u8) bool {
314pub fn strCmpLessThan(context: void, a: []const u8, b: []const u8) bool {
315315 return std.mem.order(u8, a, b) == .lt;
316316}
317317
318pub fn versionLessThan(a: []const u8, b: []const u8) bool {
318pub fn versionLessThan(context: void, a: []const u8, b: []const u8) bool {
319319 const sep_chars = "GLIBC_.";
320320 var a_tokens = std.mem.tokenize(a, sep_chars);
321321 var b_tokens = std.mem.tokenize(b, sep_chars);