authorgravatar for der.teufel.mail@gmail.comKrzysztof Wolicki <der.teufel.mail@gmail.com> 2026-07-28 18:13:17+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-08-05 03:40:30+02:00
logab4028d5796c68ca3aeb649e475bceff394942fc
tree25161b7474a58fc08267b0a2d42ae60e4ccc82a3
parentf8c6193e4c4a2e404def6c641bbd958a0226c486

Update usages of most deprecated APIs

In particular renames of `std.mem.indexOf` family to `std.mem.find` and generic unmanaged containers

88 files changed, 253 insertions(+), 250 deletions(-)

lib/build-web/time_report.zig+3-3
......@@ -84,7 +84,7 @@ pub fn compileResultMessage(msg_bytes: []u8) error{ OutOfMemory, WriteFailed }!v
8484 defer gpa.free(slowest_decls);
8585
8686 for (slowest_files) |*file_out| {
87 const i = std.mem.indexOfScalar(u8, trailing, 0) orelse @panic("malformed CompileResult message");
87 const i = std.mem.findScalar(u8, trailing, 0) orelse @panic("malformed CompileResult message");
8888 file_out.* = .{
8989 .name = trailing[0..i],
9090 .ns_sema = 0,
......@@ -95,7 +95,7 @@ pub fn compileResultMessage(msg_bytes: []u8) error{ OutOfMemory, WriteFailed }!v
9595 }
9696
9797 for (slowest_decls) |*decl_out| {
98 const i = std.mem.indexOfScalar(u8, trailing, 0) orelse @panic("malformed CompileResult message");
98 const i = std.mem.findScalar(u8, trailing, 0) orelse @panic("malformed CompileResult message");
9999 const file_idx = std.mem.readInt(u32, trailing[i..][1..5], .little);
100100 const sema_count = std.mem.readInt(u32, trailing[i..][5..9], .little);
101101 const sema_ns = std.mem.readInt(u64, trailing[i..][9..17], .little);
......@@ -258,7 +258,7 @@ pub fn runTestResultMessage(msg_bytes: []u8) error{OutOfMemory}!void {
258258 defer table_html.deinit(gpa);
259259
260260 for (durations) |test_ns| {
261 const test_name_len = std.mem.indexOfScalar(u8, trailing[offset..], 0) orelse @panic("malformed RunTestResult message");
261 const test_name_len = std.mem.findScalar(u8, trailing[offset..], 0) orelse @panic("malformed RunTestResult message");
262262 const test_name = trailing[offset..][0..test_name_len];
263263 offset += test_name_len + 1;
264264 try table_html.print(gpa, "<tr><th scope=\"row\"><code>{f}</code></th>", .{fmtEscapeHtml(test_name)});
lib/compiler/Maker.zig+1-1
......@@ -3109,7 +3109,7 @@ pub fn printErrorMessages(
31093109 try stderr.setColor(.red);
31103110 try writer.writeAll("error:");
31113111 try stderr.setColor(.reset);
3112 if (std.mem.indexOfScalar(u8, msg, '\n') == null) {
3112 if (std.mem.findScalar(u8, msg, '\n') == null) {
31133113 try writer.print(" {s}\n", .{msg});
31143114 } else switch (multiline_errors) {
31153115 .indent => {
lib/compiler/Maker/Fetch.zig+3-3
......@@ -1164,7 +1164,7 @@ const FileType = enum {
11641164 if (cd_header[value_start] != '=') return null;
11651165 value_start += 1;
11661166
1167 var value_end = std.mem.indexOfPos(u8, cd_header, value_start, ";") orelse cd_header.len;
1167 var value_end = std.mem.findPos(u8, cd_header, value_start, ";") orelse cd_header.len;
11681168 if (cd_header[value_end - 1] == '\"') {
11691169 value_end -= 1;
11701170 }
......@@ -1344,7 +1344,7 @@ fn unpackResource(
13441344 return f.fail(f.location_tok, try eb.addString("missing 'Content-Type' header"));
13451345
13461346 // Extract the MIME type, ignoring charset and boundary directives
1347 const mime_type_end = std.mem.indexOf(u8, content_type, ";") orelse content_type.len;
1347 const mime_type_end = std.mem.find(u8, content_type, ";") orelse content_type.len;
13481348 const mime_type = content_type[0..mime_type_end];
13491349
13501350 if (ascii.eqlIgnoreCase(mime_type, "application/x-tar"))
......@@ -1455,7 +1455,7 @@ fn unpackTarball(f: *Fetch, out_dir: Io.Dir, reader: *Io.Reader) RunError!Unpack
14551455
14561456 var diagnostics: std.tar.Diagnostics = .{ .allocator = arena };
14571457
1458 std.tar.pipeToFileSystem(io, out_dir, reader, .{
1458 std.tar.extract(io, out_dir, reader, .{
14591459 .diagnostics = &diagnostics,
14601460 .strip_components = 0,
14611461 .mode_mode = .ignore,
lib/compiler/Maker/Fetch/git.zig+6-6
......@@ -336,7 +336,7 @@ pub const Repository = struct {
336336 fn next(iterator: *TreeIterator) !?Entry {
337337 if (iterator.pos == iterator.data.len) return null;
338338
339 const mode_end = mem.indexOfScalarPos(u8, iterator.data, iterator.pos, ' ') orelse return error.InvalidTree;
339 const mode_end = mem.findScalarPos(u8, iterator.data, iterator.pos, ' ') orelse return error.InvalidTree;
340340 const mode: packed struct {
341341 permission: u9,
342342 unused: u3,
......@@ -351,7 +351,7 @@ pub const Repository = struct {
351351 };
352352 iterator.pos = mode_end + 1;
353353
354 const name_end = mem.indexOfScalarPos(u8, iterator.data, iterator.pos, 0) orelse return error.InvalidTree;
354 const name_end = mem.findScalarPos(u8, iterator.data, iterator.pos, 0) orelse return error.InvalidTree;
355355 const name = iterator.data[iterator.pos..name_end :0];
356356 iterator.pos = name_end + 1;
357357
......@@ -823,7 +823,7 @@ pub const Session = struct {
823823 value: ?[]const u8 = null,
824824
825825 fn parse(data: []const u8) Capability {
826 return if (mem.indexOfScalar(u8, data, '=')) |separator_pos|
826 return if (mem.findScalar(u8, data, '=')) |separator_pos|
827827 .{ .key = data[0..separator_pos], .value = data[separator_pos + 1 ..] }
828828 else
829829 .{ .key = data };
......@@ -941,17 +941,17 @@ pub const Session = struct {
941941 .flush => return null,
942942 .data => |data| {
943943 const ref_data = Packet.normalizeText(data);
944 const oid_sep_pos = mem.indexOfScalar(u8, ref_data, ' ') orelse return error.InvalidRefPacket;
944 const oid_sep_pos = mem.findScalar(u8, ref_data, ' ') orelse return error.InvalidRefPacket;
945945 const oid = Oid.parse(it.format, data[0..oid_sep_pos]) catch return error.InvalidRefPacket;
946946
947 const name_sep_pos = mem.indexOfScalarPos(u8, ref_data, oid_sep_pos + 1, ' ') orelse ref_data.len;
947 const name_sep_pos = mem.findScalarPos(u8, ref_data, oid_sep_pos + 1, ' ') orelse ref_data.len;
948948 const name = ref_data[oid_sep_pos + 1 .. name_sep_pos];
949949
950950 var symref_target: ?[]const u8 = null;
951951 var peeled: ?Oid = null;
952952 var last_sep_pos = name_sep_pos;
953953 while (last_sep_pos < ref_data.len) {
954 const next_sep_pos = mem.indexOfScalarPos(u8, ref_data, last_sep_pos + 1, ' ') orelse ref_data.len;
954 const next_sep_pos = mem.findScalarPos(u8, ref_data, last_sep_pos + 1, ' ') orelse ref_data.len;
955955 const attribute = ref_data[last_sep_pos + 1 .. next_sep_pos];
956956 if (mem.startsWith(u8, attribute, "symref-target:")) {
957957 symref_target = attribute["symref-target:".len..];
lib/compiler/Maker/Step/Run.zig+2-2
......@@ -555,7 +555,7 @@ const FuzzTestRunner = struct {
555555
556556 const Instance = struct {
557557 child: process.Child,
558 message: std.ArrayListAligned(u8, .@"4"),
558 message: std.array_list.Aligned(u8, .@"4"),
559559 broadcast_written: usize,
560560 stderr: std.ArrayList(u8),
561561 stdin_vec: [1][]u8,
......@@ -2120,7 +2120,7 @@ fn fmtSnapshotIndicatorLine(buf: []const u8, index: usize) std.fmt.Alt(
21202120}
21212121
21222122fn snapshotIndicatorLine(line: FmtIndicatorLine, w: *std.Io.Writer) std.Io.Writer.Error!void {
2123 const line_begin_index = if (std.mem.lastIndexOfScalar(u8, line.buf[0..line.index], '\n')) |line_begin|
2123 const line_begin_index = if (std.mem.findScalarLast(u8, line.buf[0..line.index], '\n')) |line_begin|
21242124 line_begin + 1
21252125 else
21262126 0;
lib/compiler/configurer.zig+1-1
......@@ -83,7 +83,7 @@ pub fn main(init: process.Init.Minimal) !void {
8383 if (mem.cutPrefix(u8, arg, "-D")) |option_contents| {
8484 if (option_contents.len == 0)
8585 fatalWithHint("expected option name after '-D'", .{});
86 if (mem.indexOfScalar(u8, option_contents, '=')) |name_end| {
86 if (mem.findScalar(u8, option_contents, '=')) |name_end| {
8787 const option_name = option_contents[0..name_end];
8888 const option_value = option_contents[name_end + 1 ..];
8989 if (try builder.addUserInputOption(option_name, option_value))
lib/compiler/resinator/compile.zig+3-3
......@@ -540,7 +540,7 @@ pub const Compiler = struct {
540540 // This currently only checks for NUL bytes, but it should probably also check for
541541 // platform-specific invalid characters like '*', '?', '"', '<', '>', '|' (Windows)
542542 // Related: https://github.com/ziglang/zig/pull/14533#issuecomment-1416888193
543 if (std.mem.indexOfScalar(u8, filename_utf8, 0) != null) {
543 if (std.mem.findScalar(u8, filename_utf8, 0) != null) {
544544 return self.addErrorDetailsAndFail(.{
545545 .err = .invalid_filename,
546546 .token = node.filename.getFirstToken(),
......@@ -2919,11 +2919,11 @@ fn validateSearchPath(path: []const u8) error{BadPathName}!void {
29192919 var component_iterator = std.fs.path.componentIterator(path);
29202920 while (component_iterator.next()) |component| {
29212921 // https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file
2922 if (std.mem.indexOfAny(u8, component.name, "\x00<>:\"|?*") != null) return error.BadPathName;
2922 if (std.mem.findAny(u8, component.name, "\x00<>:\"|?*") != null) return error.BadPathName;
29232923 }
29242924 },
29252925 else => {
2926 if (std.mem.indexOfScalar(u8, path, 0) != null) return error.BadPathName;
2926 if (std.mem.findScalar(u8, path, 0) != null) return error.BadPathName;
29272927 },
29282928 }
29292929}
lib/compiler/resinator/cvtres.zig+1-1
......@@ -1056,7 +1056,7 @@ pub const supported_targets = struct {
10561056 comptime {
10571057 const info = @typeInfo(Arch).@"enum";
10581058 for (info.field_names, info.field_values) |field_name, field_value| {
1059 _ = std.mem.indexOfScalar(Arch, ordered_for_display, @fromBackingInt(@intCast(field_value))) orelse {
1059 _ = std.mem.findScalar(Arch, ordered_for_display, @fromBackingInt(@intCast(field_value))) orelse {
10601060 @compileError(std.fmt.comptimePrint("'{s}' missing from ordered_for_display", .{field_name}));
10611061 };
10621062 }
lib/compiler/resinator/errors.zig+1-1
......@@ -506,7 +506,7 @@ pub const ErrorDetails = struct {
506506 // We know that the token slice is a well-formed #pragma code_page(N), so
507507 // we can skip to the first ( and then get the number that follows
508508 const token_slice = self.token.slice(source);
509 var number_start = std.mem.indexOfScalar(u8, token_slice, '(').? + 1;
509 var number_start = std.mem.findScalar(u8, token_slice, '(').? + 1;
510510 while (std.ascii.isWhitespace(token_slice[number_start])) {
511511 number_start += 1;
512512 }
lib/compiler/resinator/source_mapping.zig+1-1
......@@ -538,7 +538,7 @@ pub fn handleLineCommand(allocator: Allocator, line_command: []const u8, current
538538 defer allocator.free(filename);
539539
540540 // \x00 bytes in the filename is incompatible with how StringTable works
541 if (std.mem.indexOfScalar(u8, filename, '\x00') != null) return error.InvalidLineCommand;
541 if (std.mem.findScalar(u8, filename, '\x00') != null) return error.InvalidLineCommand;
542542
543543 current_mapping.line_num = linenum;
544544 current_mapping.filename.clearRetainingCapacity();
lib/docs/wasm/html_render.zig+1-1
......@@ -62,7 +62,7 @@ pub fn fileSourceHtml(
6262 var cursor: usize = ast.tokenStart(start_token);
6363
6464 var indent: usize = 0;
65 if (std.mem.lastIndexOf(u8, ast.source[0..cursor], "\n")) |newline_index| {
65 if (std.mem.findLast(u8, ast.source[0..cursor], "\n")) |newline_index| {
6666 for (ast.source[newline_index + 1 .. cursor]) |c| {
6767 if (c == ' ') {
6868 indent += 1;
lib/docs/wasm/main.zig+3-3
......@@ -153,11 +153,11 @@ fn query_exec_fallible(query: []const u8, ignore_case: bool) !void {
153153 continue;
154154 }
155155 // substring, case insensitive match of full decl path
156 if (std.mem.indexOf(u8, g.full_path_search_text_lower.items, term) != null) {
156 if (std.mem.find(u8, g.full_path_search_text_lower.items, term) != null) {
157157 points += 2;
158158 continue;
159159 }
160 if (std.mem.indexOf(u8, g.doc_search_text.items, term) != null) {
160 if (std.mem.find(u8, g.doc_search_text.items, term) != null) {
161161 points += 1;
162162 continue;
163163 }
......@@ -803,7 +803,7 @@ fn unpackInner(tar_bytes: []u8) !void {
803803 if (std.mem.endsWith(u8, tar_file.name, ".zig")) {
804804 log.debug("found file: '{s}'", .{tar_file.name});
805805 const file_name = try gpa.dupe(u8, tar_file.name);
806 if (std.mem.indexOfScalar(u8, file_name, '/')) |pkg_name_end| {
806 if (std.mem.findScalar(u8, file_name, '/')) |pkg_name_end| {
807807 const pkg_name = file_name[0..pkg_name_end];
808808 const gop = try Walk.modules.getOrPut(gpa, pkg_name);
809809 const file: Walk.File.Index = @fromBackingInt(@intCast(Walk.files.entries.len));
lib/docs/wasm/markdown/Parser.zig+10-10
......@@ -159,7 +159,7 @@ const Block = struct {
159159 .heading => null,
160160 .code_block => code_block: {
161161 const trimmed = mem.trimEnd(u8, unindented, " \t");
162 if (mem.indexOfNone(u8, trimmed, "`") != null or trimmed.len != b.data.code_block.fence_len) {
162 if (mem.findNone(u8, trimmed, "`") != null or trimmed.len != b.data.code_block.fence_len) {
163163 const effective_indent = @min(indent, b.data.code_block.indent);
164164 break :code_block line[effective_indent..];
165165 } else {
......@@ -594,7 +594,7 @@ fn startListItem(unindented_line: []const u8) ?ListItemStart {
594594 };
595595 }
596596
597 const number_end = mem.indexOfNone(u8, unindented_line, "0123456789") orelse return null;
597 const number_end = mem.findNone(u8, unindented_line, "0123456789") orelse return null;
598598 const after_number = unindented_line[number_end..];
599599 const marker: Block.Data.ListMarker = if (mem.startsWith(u8, after_number, ". "))
600600 .number_dot
......@@ -639,10 +639,10 @@ fn startTableRow(unindented_line: []const u8) ?TableRowStart {
639639 // Ignoring pipes in code spans allows table cells to contain
640640 // code using ||, for example.
641641 const open_start = i;
642 i = mem.indexOfNonePos(u8, table_row_content, i, "`") orelse return null;
642 i = mem.findNonePos(u8, table_row_content, i, "`") orelse return null;
643643 const open_len = i - open_start;
644 while (mem.indexOfScalarPos(u8, table_row_content, i, '`')) |close_start| {
645 i = mem.indexOfNonePos(u8, table_row_content, close_start, "`") orelse return null;
644 while (mem.findScalarPos(u8, table_row_content, i, '`')) |close_start| {
645 i = mem.findNonePos(u8, table_row_content, close_start, "`") orelse return null;
646646 const close_len = i - close_start;
647647 if (close_len == open_len) break;
648648 } else return null;
......@@ -794,7 +794,7 @@ fn startCodeBlock(p: *Parser, unindented_line: []const u8) !?CodeBlockStart {
794794 } else "";
795795 // Code block tags may not contain backticks, since that would create
796796 // potential confusion with inline code spans.
797 if (fence_len < 3 or mem.indexOfScalar(u8, tag_bytes, '`') != null) return null;
797 if (fence_len < 3 or mem.findScalar(u8, tag_bytes, '`') != null) return null;
798798 return .{
799799 .tag = try p.addString(mem.trim(u8, tag_bytes, " ")),
800800 .fence_len = fence_len,
......@@ -1382,12 +1382,12 @@ const InlineParser = struct {
13821382 /// parsing.
13831383 fn parseCodeSpan(ip: *InlineParser) !void {
13841384 const opener_start = ip.pos;
1385 ip.pos = mem.indexOfNonePos(u8, ip.content, ip.pos, "`") orelse ip.content.len;
1385 ip.pos = mem.findNonePos(u8, ip.content, ip.pos, "`") orelse ip.content.len;
13861386 const opener_len = ip.pos - opener_start;
13871387
13881388 const start = ip.pos;
1389 const end = while (mem.indexOfScalarPos(u8, ip.content, ip.pos, '`')) |closer_start| {
1390 ip.pos = mem.indexOfNonePos(u8, ip.content, closer_start, "`") orelse ip.content.len;
1389 const end = while (mem.findScalarPos(u8, ip.content, ip.pos, '`')) |closer_start| {
1390 ip.pos = mem.findNonePos(u8, ip.content, closer_start, "`") orelse ip.content.len;
13911391 const closer_len = ip.pos - closer_start;
13921392
13931393 if (closer_len == opener_len) break closer_start;
......@@ -1627,7 +1627,7 @@ fn addScratchStringLine(p: *Parser, line: []const u8) !void {
16271627}
16281628
16291629fn isBlank(line: []const u8) bool {
1630 return mem.indexOfNone(u8, line, " \t") == null;
1630 return mem.findNone(u8, line, " \t") == null;
16311631}
16321632
16331633fn isPunctuation(c: u8) bool {
lib/fuzzer.zig+1-1
......@@ -1085,7 +1085,7 @@ const Fuzzer = struct {
10851085 fn removeBest(f: *Fuzzer, i: Input.Index, best_i: u32) void {
10861086 const t = &f.tests[f.test_i];
10871087 const ref = &t.corpus.items(.ref)[@backingInt(i)];
1088 const list_i = mem.indexOfScalar(u32, ref.best_i_buf[0..ref.best_i_len], best_i).?;
1088 const list_i = mem.findScalar(u32, ref.best_i_buf[0..ref.best_i_len], best_i).?;
10891089 ref.best_i_len -= 1;
10901090 ref.best_i_buf[list_i] = ref.best_i_buf[ref.best_i_len];
10911091
lib/std/Build.zig+5-2
......@@ -830,7 +830,7 @@ pub fn addTest(b: *Build, options: TestOptions) *Step.Compile {
830830 .kind = if (options.emit_object) .test_obj else .@"test",
831831 .root_module = options.root_module,
832832 .max_rss = options.max_rss,
833 .filters = b.dupeStrings(options.filters),
833 .filters = b.graph.dupeStrings(options.filters),
834834 .test_runner = options.test_runner,
835835 .use_llvm = options.use_llvm,
836836 .use_lld = options.use_lld,
......@@ -2648,7 +2648,10 @@ pub const LazyPath = union(enum) {
26482648
26492649 fn dupeInner(lazy_path: LazyPath, arena: Allocator) LazyPath {
26502650 return switch (lazy_path) {
2651 .src_path => |sp| .{ .src_path = .{ .owner = sp.owner, .sub_path = sp.owner.dupePath(sp.sub_path) } },
2651 .src_path => |sp| .{ .src_path = .{
2652 .owner = sp.owner,
2653 .sub_path = sp.owner.graph.dupePath(sp.sub_path),
2654 } },
26522655 .cwd_relative => |p| .{ .cwd_relative = Graph.dupePathInner(arena, p) },
26532656 .relative => |r| .{ .relative = r },
26542657 .generated => |gen| .{ .generated = .{
lib/std/Build/Configuration.zig+4-4
......@@ -121,7 +121,7 @@ pub const Wip = struct {
121121 }
122122
123123 pub fn hash(_: @This(), adapted_key: []const u8) u64 {
124 assert(std.mem.indexOfScalar(u8, adapted_key, 0) == null);
124 assert(std.mem.findScalar(u8, adapted_key, 0) == null);
125125 return std.hash_map.hashString(adapted_key);
126126 }
127127 };
......@@ -182,7 +182,7 @@ pub const Wip = struct {
182182
183183 pub fn addString(wip: *Wip, bytes: []const u8) Allocator.Error!String {
184184 const gpa = wip.gpa;
185 assert(std.mem.indexOfScalar(u8, bytes, 0) == null);
185 assert(std.mem.findScalar(u8, bytes, 0) == null);
186186 const gop = try wip.string_table.getOrPutContextAdapted(
187187 gpa,
188188 @as([]const u8, bytes),
......@@ -439,7 +439,7 @@ pub const Wip = struct {
439439 /// Returned slice expires upon next append to the configuration.
440440 pub fn stringSlice(wip: *const Wip, s: String) [:0]const u8 {
441441 const start_slice = wip.string_bytes.items[@backingInt(s)..];
442 return start_slice[0..std.mem.indexOfScalar(u8, start_slice, 0).? :0];
442 return start_slice[0..std.mem.findScalar(u8, start_slice, 0).? :0];
443443 }
444444};
445445
......@@ -1953,7 +1953,7 @@ pub const String = enum(u32) {
19531953
19541954 pub fn slice(index: String, c: *const Configuration) [:0]const u8 {
19551955 const start_slice = c.string_bytes[@backingInt(index)..];
1956 return start_slice[0..std.mem.indexOfScalar(u8, start_slice, 0).? :0];
1956 return start_slice[0..std.mem.findScalar(u8, start_slice, 0).? :0];
19571957 }
19581958};
19591959
lib/std/Build/Module.zig+2-2
......@@ -402,8 +402,8 @@ pub fn addCSourceFiles(m: *Module, options: AddCSourceFilesOptions) void {
402402 const c_source_files = arena.create(CSourceFiles) catch @panic("OOM");
403403 c_source_files.* = .{
404404 .root = options.root orelse b.path(""),
405 .files = b.dupeStrings(options.files),
406 .flags = b.dupeStrings(options.flags),
405 .files = b.graph.dupeStrings(options.files),
406 .flags = b.graph.dupeStrings(options.flags),
407407 .language = options.language,
408408 };
409409 m.link_objects.append(arena, .{ .c_source_files = c_source_files }) catch @panic("OOM");
lib/std/Build/Step/Compile.zig+1-1
......@@ -375,7 +375,7 @@ pub fn create(owner: *std.Build, options: Options) *Compile {
375375 const graph = owner.graph;
376376 const arena = graph.arena;
377377
378 const name = owner.dupe(options.name);
378 const name = owner.graph.dupeString(options.name);
379379 if (mem.find(u8, name, "/") != null or mem.find(u8, name, "\\") != null) {
380380 panic("invalid name: '{s}'. It looks like a file path, but it is supposed to be the library or application name.", .{name});
381381 }
lib/std/Io/Dispatch.zig+3-3
......@@ -2782,7 +2782,7 @@ fn realPath(ev: *Evented, fd: c.fd_t, out_buffer: []u8) File.RealPathError!usize
27822782 else => |err| return unexpectedErrno(err),
27832783 }
27842784 }
2785 const n = std.mem.indexOfScalar(u8, &buffer, 0) orelse buffer.len;
2785 const n = std.mem.findScalar(u8, &buffer, 0) orelse buffer.len;
27862786 if (n > out_buffer.len) return error.NameTooLong;
27872787 @memcpy(out_buffer[0..n], buffer[0..n]);
27882788 return n;
......@@ -2804,7 +2804,7 @@ fn dirRealPathFile(
28042804 while (true) {
28052805 if (c.realpath(sub_path_posix, out_buffer.ptr)) |redundant_pointer| {
28062806 assert(redundant_pointer == out_buffer.ptr);
2807 return std.mem.indexOfScalar(u8, out_buffer, 0) orelse out_buffer.len;
2807 return std.mem.findScalar(u8, out_buffer, 0) orelse out_buffer.len;
28082808 }
28092809 const err: c.E = @fromBackingInt(@intCast(c._errno().*));
28102810 switch (err) {
......@@ -3792,7 +3792,7 @@ fn fileRealPath(userdata: ?*anyopaque, file: File, out_buffer: []u8) File.RealPa
37923792 else => |err| return unexpectedErrno(err),
37933793 }
37943794 }
3795 const n = std.mem.indexOfScalar(u8, &buffer, 0) orelse buffer.len;
3795 const n = std.mem.findScalar(u8, &buffer, 0) orelse buffer.len;
37963796 if (n > out_buffer.len) return error.NameTooLong;
37973797 @memcpy(out_buffer[0..n], buffer[0..n]);
37983798 return n;
lib/std/Io/Threaded.zig+5-5
......@@ -6836,7 +6836,7 @@ fn dirRealPathFilePosix(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, o
68366836 if (std.c.realpath(sub_path_posix, out_buffer.ptr)) |redundant_pointer| {
68376837 syscall.finish();
68386838 assert(redundant_pointer == out_buffer.ptr);
6839 return std.mem.indexOfScalar(u8, out_buffer, 0) orelse out_buffer.len;
6839 return std.mem.findScalar(u8, out_buffer, 0) orelse out_buffer.len;
68406840 }
68416841 const err: posix.E = @fromBackingInt(@intCast(std.c._errno().*));
68426842 if (err == .INTR) {
......@@ -6980,7 +6980,7 @@ fn realPathPosix(fd: posix.fd_t, out_buffer: []u8) File.RealPathError!usize {
69806980 },
69816981 }
69826982 }
6983 const n = std.mem.indexOfScalar(u8, &sufficient_buffer, 0) orelse sufficient_buffer.len;
6983 const n = std.mem.findScalar(u8, &sufficient_buffer, 0) orelse sufficient_buffer.len;
69846984 if (n > out_buffer.len) return error.NameTooLong;
69856985 @memcpy(out_buffer[0..n], sufficient_buffer[0..n]);
69866986 return n;
......@@ -8999,7 +8999,7 @@ fn isCygwinPty(file: File) Io.Cancelable!bool {
89998999 // The name we get from NtQueryInformationFile will be prefixed with a '\', e.g. \msys-1888ae32e00d56aa-pty0-to-master
90009000 return (std.mem.startsWith(u16, name_wide, &[_]u16{ '\\', 'm', 's', 'y', 's', '-' }) or
90019001 std.mem.startsWith(u16, name_wide, &[_]u16{ '\\', 'c', 'y', 'g', 'w', 'i', 'n', '-' })) and
9002 std.mem.indexOf(u16, name_wide, &[_]u16{ '-', 'p', 't', 'y' }) != null;
9002 std.mem.find(u16, name_wide, &[_]u16{ '-', 'p', 't', 'y' }) != null;
90039003}
90049004
90059005fn fileSetLength(userdata: ?*anyopaque, file: File, length: u64) File.SetLengthError!void {
......@@ -16315,7 +16315,7 @@ fn windowsCreateProcessPathExt(
1631516315
1631616316 const is_bat_or_cmd = bat_or_cmd: {
1631716317 const app_name = app_buf.items[0..app_name_len];
16318 const ext_start = std.mem.lastIndexOfScalar(u16, app_name, '.') orelse break :bat_or_cmd false;
16318 const ext_start = std.mem.findScalarLast(u16, app_name, '.') orelse break :bat_or_cmd false;
1631916319 const ext = app_name[ext_start..];
1632016320 const ext_enum = windowsCreateProcessSupportsExtension(ext) orelse break :bat_or_cmd false;
1632116321 switch (ext_enum) {
......@@ -16351,7 +16351,7 @@ fn windowsCreateProcessPathExt(
1635116351 // it's treated as an unrecoverable error. Otherwise, it'll be
1635216352 // skipped as normal.
1635316353 const app_name = app_buf.items[0..app_name_len];
16354 const ext_start = std.mem.lastIndexOfScalar(u16, app_name, '.') orelse break :unappended err;
16354 const ext_start = std.mem.findScalarLast(u16, app_name, '.') orelse break :unappended err;
1635516355 const ext = app_name[ext_start..];
1635616356 if (windows.eqlIgnoreCaseWtf16(ext, std.unicode.utf8ToUtf16LeStringLiteral(".EXE"))) {
1635716357 return error.UnrecoverableInvalidExe;
lib/std/Uri.zig+4-4
......@@ -221,16 +221,16 @@ pub fn parseAfterScheme(scheme: []const u8, text: []const u8) ParseError!Uri {
221221 }
222222
223223 if (authority.len > start_of_host and authority[start_of_host] == '[') { // IPv6
224 end_of_host = std.mem.lastIndexOf(u8, authority, "]") orelse return error.InvalidFormat;
224 end_of_host = std.mem.findLast(u8, authority, "]") orelse return error.InvalidFormat;
225225 end_of_host += 1;
226226
227 if (std.mem.lastIndexOf(u8, authority, ":")) |index| {
227 if (std.mem.findLast(u8, authority, ":")) |index| {
228228 if (index >= end_of_host) { // if not part of the V6 address field
229229 end_of_host = @min(end_of_host, index);
230230 uri.port = std.fmt.parseInt(u16, authority[index + 1 ..], 10) catch return error.InvalidPort;
231231 }
232232 }
233 } else if (std.mem.lastIndexOf(u8, authority, ":")) |index| {
233 } else if (std.mem.findLast(u8, authority, ":")) |index| {
234234 if (index >= start_of_host) { // if not part of the userinfo field
235235 end_of_host = @min(end_of_host, index);
236236 uri.port = std.fmt.parseInt(u16, authority[index + 1 ..], 10) catch return error.InvalidPort;
......@@ -475,7 +475,7 @@ fn merge_paths(base: Component, new: []u8, aux_buf: *[]u8) error{NoSpaceLeft}!Co
475475 var aux: Writer = .fixed(aux_buf.*);
476476 if (!base.isEmpty()) {
477477 base.formatPath(&aux) catch return error.NoSpaceLeft;
478 aux.end = std.mem.lastIndexOfScalar(u8, aux.buffered(), '/') orelse return remove_dot_segments(new);
478 aux.end = std.mem.findScalarLast(u8, aux.buffered(), '/') orelse return remove_dot_segments(new);
479479 }
480480 aux.print("/{s}", .{new}) catch return error.NoSpaceLeft;
481481 const merged_path = remove_dot_segments(aux.buffered());
lib/std/array_hash_map.zig+7-7
......@@ -13,12 +13,12 @@ const hash_map = @This();
1313///
1414/// See `AutoContext` for a description of the hash and equal implementations.
1515pub fn Auto(comptime K: type, comptime V: type) type {
16 return ArrayHashMap(K, V, AutoContext(K), !autoEqlIsCheap(K));
16 return Custom(K, V, AutoContext(K), !autoEqlIsCheap(K));
1717}
1818
1919/// An `ArrayHashMap` with strings as keys.
2020pub fn String(comptime V: type) type {
21 return ArrayHashMap([]const u8, V, StringContext, true);
21 return Custom([]const u8, V, StringContext, true);
2222}
2323
2424pub const StringContext = struct {
......@@ -2130,7 +2130,7 @@ test "0 sized key and 0 sized value" {
21302130test "setKey storehash true" {
21312131 const gpa = std.testing.allocator;
21322132
2133 var map: ArrayHashMap(i32, i32, AutoContext(i32), true) = .empty;
2133 var map: Custom(i32, i32, AutoContext(i32), true) = .empty;
21342134 defer map.deinit(gpa);
21352135
21362136 try map.put(gpa, 12, 34);
......@@ -2146,7 +2146,7 @@ test "setKey storehash true" {
21462146test "setKey storehash false" {
21472147 const gpa = std.testing.allocator;
21482148
2149 var map: ArrayHashMap(i32, i32, AutoContext(i32), false) = .empty;
2149 var map: Custom(i32, i32, AutoContext(i32), false) = .empty;
21502150 defer map.deinit(gpa);
21512151
21522152 try map.put(gpa, 12, 34);
......@@ -2162,7 +2162,7 @@ test "setKey storehash false" {
21622162test "setKey storehash false with index" {
21632163 const gpa = std.testing.allocator;
21642164
2165 const T = ArrayHashMap(usize, usize, AutoContext(usize), false);
2165 const T = Custom(usize, usize, AutoContext(usize), false);
21662166
21672167 var map: T = .empty;
21682168 defer map.deinit(gpa);
......@@ -2180,9 +2180,9 @@ test "setKey storehash false with index" {
21802180test "setKey storehash true with index" {
21812181 const gpa = std.testing.allocator;
21822182
2183 const T = ArrayHashMap(usize, usize, AutoContext(usize), false);
2183 const T = Custom(usize, usize, AutoContext(usize), false);
21842184
2185 var map: ArrayHashMap(usize, usize, AutoContext(usize), true) = .empty;
2185 var map: Custom(usize, usize, AutoContext(usize), true) = .empty;
21862186 defer map.deinit(gpa);
21872187
21882188 for (0..T.linear_scan_max + 1) |i| try map.put(gpa, i, i);
lib/std/crypto/Certificate.zig+3-3
......@@ -1148,9 +1148,9 @@ pub const rsa = struct {
11481148 }
11491149 var m_p_buf: [8 + Hash.digest_length + Hash.digest_length]u8 = undefined;
11501150 var m_p = m_p_buf[0 .. 8 + Hash.digest_length + sLen];
1151 std.mem.copyForwards(u8, m_p, @as(*const [8]u8, &@splat(0)));
1152 std.mem.copyForwards(u8, m_p[8..], &mHash);
1153 std.mem.copyForwards(u8, m_p[(8 + Hash.digest_length)..], salt);
1151 @memmove(m_p, @as(*const [8]u8, &@splat(0)));
1152 @memmove(m_p[8..], &mHash);
1153 @memmove(m_p[(8 + Hash.digest_length)..], salt);
11541154
11551155 // 13. Let H' = Hash(M'), an octet string of length hLen.
11561156 var h_p: [Hash.digest_length]u8 = undefined;
lib/std/fs/path.zig+2-2
......@@ -1830,7 +1830,7 @@ fn testRelativeWindows(from: []const u8, to: []const u8, expected_output: []cons
18301830/// pointer address range of `path`, even if it is length zero.
18311831pub fn extension(path: []const u8) []const u8 {
18321832 const filename = basename(path);
1833 const index = mem.lastIndexOfScalar(u8, filename, '.') orelse return path[path.len..];
1833 const index = mem.findScalarLast(u8, filename, '.') orelse return path[path.len..];
18341834 if (index == 0) return path[path.len..];
18351835 return filename[index..];
18361836}
......@@ -1887,7 +1887,7 @@ test extension {
18871887/// - "hello/world/lib" ⇒ "lib"
18881888pub fn stem(path: []const u8) []const u8 {
18891889 const filename = basename(path);
1890 const index = mem.lastIndexOfScalar(u8, filename, '.') orelse return filename[0..];
1890 const index = mem.findScalarLast(u8, filename, '.') orelse return filename[0..];
18911891 if (index == 0) return path;
18921892 return filename[0..index];
18931893}
lib/std/heap/SafeAllocator.zig+1-1
......@@ -1519,7 +1519,7 @@ const FuzzSingleThreadedAllocator = struct {
15191519 @disableInstrumentation();
15201520
15211521 const allocs_slice = f.allocs.slice();
1522 const i = mem.indexOfScalar([*]u8, allocs_slice.items(.ptr), memory.ptr) orelse panic(
1522 const i = mem.findScalar([*]u8, allocs_slice.items(.ptr), memory.ptr) orelse panic(
15231523 "invalid SafeAllocator free of {f}",
15241524 .{FormatMemory{ .memory = memory, .alignment = alignment }},
15251525 );
lib/std/http/Server.zig+1-1
......@@ -102,7 +102,7 @@ pub const Request = struct {
102102 const method = std.meta.stringToEnum(http.Method, first_line[0..method_end]) orelse
103103 return error.UnknownHttpMethod;
104104
105 const version_start = mem.lastIndexOfScalar(u8, first_line, ' ') orelse
105 const version_start = mem.findScalarLast(u8, first_line, ' ') orelse
106106 return error.HttpHeadersInvalid;
107107 if (version_start == method_end) return error.HttpHeadersInvalid;
108108
lib/std/mem.zig+16-16
......@@ -1528,7 +1528,7 @@ pub fn findLast(comptime T: type, haystack: []const T, needle: []const T) ?usize
15281528 if (needle.len == 0) return haystack.len;
15291529
15301530 if (!std.meta.hasUniqueRepresentation(T) or haystack.len < 52 or needle.len <= 4)
1531 return lastIndexOfLinear(T, haystack, needle);
1531 return findLastLinear(T, haystack, needle);
15321532
15331533 const haystack_bytes = sliceAsBytes(haystack);
15341534 const needle_bytes = sliceAsBytes(needle);
......@@ -1583,26 +1583,26 @@ pub fn findPos(comptime T: type, haystack: []const T, start_index: usize, needle
15831583
15841584test find {
15851585 try testing.expect(find(u8, "one two three four five six seven eight nine ten eleven", "three four").? == 8);
1586 try testing.expect(lastIndexOf(u8, "one two three four five six seven eight nine ten eleven", "three four").? == 8);
1586 try testing.expect(findLast(u8, "one two three four five six seven eight nine ten eleven", "three four").? == 8);
15871587 try testing.expect(find(u8, "one two three four five six seven eight nine ten eleven", "two two") == null);
1588 try testing.expect(lastIndexOf(u8, "one two three four five six seven eight nine ten eleven", "two two") == null);
1588 try testing.expect(findLast(u8, "one two three four five six seven eight nine ten eleven", "two two") == null);
15891589
15901590 try testing.expect(find(u8, "one two three four five six seven eight nine ten", "").? == 0);
1591 try testing.expect(lastIndexOf(u8, "one two three four five six seven eight nine ten", "").? == 48);
1591 try testing.expect(findLast(u8, "one two three four five six seven eight nine ten", "").? == 48);
15921592
15931593 try testing.expect(find(u8, "one two three four", "four").? == 14);
1594 try testing.expect(lastIndexOf(u8, "one two three two four", "two").? == 14);
1594 try testing.expect(findLast(u8, "one two three two four", "two").? == 14);
15951595 try testing.expect(find(u8, "one two three four", "gour") == null);
1596 try testing.expect(lastIndexOf(u8, "one two three four", "gour") == null);
1596 try testing.expect(findLast(u8, "one two three four", "gour") == null);
15971597 try testing.expect(find(u8, "foo", "foo").? == 0);
1598 try testing.expect(lastIndexOf(u8, "foo", "foo").? == 0);
1598 try testing.expect(findLast(u8, "foo", "foo").? == 0);
15991599 try testing.expect(find(u8, "foo", "fool") == null);
1600 try testing.expect(lastIndexOf(u8, "foo", "lfoo") == null);
1601 try testing.expect(lastIndexOf(u8, "foo", "fool") == null);
1600 try testing.expect(findLast(u8, "foo", "lfoo") == null);
1601 try testing.expect(findLast(u8, "foo", "fool") == null);
16021602
16031603 try testing.expect(find(u8, "foo foo", "foo").? == 0);
1604 try testing.expect(lastIndexOf(u8, "foo foo", "foo").? == 4);
1605 try testing.expect(lastIndexOfAny(u8, "boo, cat", "abo").? == 6);
1604 try testing.expect(findLast(u8, "foo foo", "foo").? == 4);
1605 try testing.expect(findLastAny(u8, "boo, cat", "abo").? == 6);
16061606 try testing.expect(findScalarLast(u8, "boo", 'o').? == 2);
16071607}
16081608
......@@ -1624,13 +1624,13 @@ test "find multibyte" {
16241624 // make haystack and needle long enough to trigger Boyer-Moore-Horspool algorithm
16251625 const haystack = [_]u16{ 0xbbaa, 0xccbb, 0xddcc, 0xeedd, 0xffee, 0x00ff } ++ @as([100]u16, @splat(0));
16261626 const needle = [_]u16{ 0xbbaa, 0xccbb, 0xddcc, 0xeedd, 0xffee };
1627 try testing.expectEqual(lastIndexOf(u16, &haystack, &needle), 0);
1627 try testing.expectEqual(findLast(u16, &haystack, &needle), 0);
16281628
16291629 // check for misaligned false positives (little and big endian)
16301630 const needleLE = [_]u16{ 0xbbbb, 0xcccc, 0xdddd, 0xeeee, 0xffff };
1631 try testing.expectEqual(lastIndexOf(u16, &haystack, &needleLE), null);
1631 try testing.expectEqual(findLast(u16, &haystack, &needleLE), null);
16321632 const needleBE = [_]u16{ 0xaacc, 0xbbdd, 0xccee, 0xddff, 0xee00 };
1633 try testing.expectEqual(lastIndexOf(u16, &haystack, &needleBE), null);
1633 try testing.expectEqual(findLast(u16, &haystack, &needleBE), null);
16341634 }
16351635}
16361636
......@@ -3485,8 +3485,8 @@ pub fn SplitBackwardsIterator(comptime T: type, comptime delimiter_type: Delimit
34853485 pub fn next(self: *Self) ?[]const T {
34863486 const end = self.index orelse return null;
34873487 const start = if (switch (delimiter_type) {
3488 .sequence => lastIndexOf(T, self.buffer[0..end], self.delimiter),
3489 .any => lastIndexOfAny(T, self.buffer[0..end], self.delimiter),
3488 .sequence => findLast(T, self.buffer[0..end], self.delimiter),
3489 .any => findLastAny(T, self.buffer[0..end], self.delimiter),
34903490 .scalar => findScalarLast(T, self.buffer[0..end], self.delimiter),
34913491 }) |delim_start| blk: {
34923492 self.index = delim_start;
lib/std/os/linux/IoUring/test.zig+1-1
......@@ -2699,7 +2699,7 @@ inline fn skipKernelLessThan(required: std.SemanticVersion) !void {
26992699
27002700 const release = mem.sliceTo(&uts.release, 0);
27012701 // Strips potential extra, as kernel version might not be semver compliant, example "6.8.9-300.fc40.x86_64"
2702 const extra_index = std.mem.indexOfAny(u8, release, "-+");
2702 const extra_index = std.mem.findAny(u8, release, "-+");
27032703 const stripped = release[0..(extra_index orelse release.len)];
27042704 // Make sure the input don't rely on the extra we just stripped
27052705 try testing.expect(required.pre == null and required.build == null);
lib/std/tar/Writer.zig+1-1
......@@ -312,7 +312,7 @@ pub const Header = extern struct {
312312
313313 // add as much to prefix as you can, must split at /
314314 const prefix_remaining = max_prefix - prefix_pos;
315 if (std.mem.lastIndexOf(u8, sub_path[0..@min(prefix_remaining, sub_path.len)], &.{'/'})) |sep_pos| {
315 if (std.mem.findLast(u8, sub_path[0..@min(prefix_remaining, sub_path.len)], &.{'/'})) |sep_pos| {
316316 @memcpy(w.prefix[prefix_pos..][0..sep_pos], sub_path[0..sep_pos]);
317317 if ((sub_path.len - sep_pos - 1) > max_name) return error.NameTooLong;
318318 @memcpy(w.name[0..][0 .. sub_path.len - sep_pos - 1], sub_path[sep_pos + 1 ..]);
lib/std/tar/test.zig+3-3
......@@ -474,14 +474,14 @@ test "should not overwrite existing file" {
474474 defer root.cleanup();
475475 try testing.expectError(
476476 error.PathAlreadyExists,
477 tar.pipeToFileSystem(io, root.dir, &r, .{ .mode_mode = .ignore, .strip_components = 1 }),
477 tar.extract(io, root.dir, &r, .{ .mode_mode = .ignore, .strip_components = 1 }),
478478 );
479479
480480 // Unpack with strip_components = 0 should pass
481481 r = .fixed(data);
482482 var root2 = std.testing.tmpDir(.{});
483483 defer root2.cleanup();
484 try tar.pipeToFileSystem(io, root2.dir, &r, .{ .mode_mode = .ignore, .strip_components = 0 });
484 try tar.extract(io, root2.dir, &r, .{ .mode_mode = .ignore, .strip_components = 0 });
485485}
486486
487487test "case sensitivity" {
......@@ -501,7 +501,7 @@ test "case sensitivity" {
501501 var root = std.testing.tmpDir(.{});
502502 defer root.cleanup();
503503
504 tar.pipeToFileSystem(io, root.dir, &r, .{ .mode_mode = .ignore, .strip_components = 1 }) catch |err| {
504 tar.extract(io, root.dir, &r, .{ .mode_mode = .ignore, .strip_components = 1 }) catch |err| {
505505 // on case insensitive fs we fail on overwrite existing file
506506 try testing.expectEqual(error.PathAlreadyExists, err);
507507 return;
lib/std/testing.zig+1-1
......@@ -999,7 +999,7 @@ test "expectEqualDeep composite type" {
999999}
10001000
10011001fn printIndicatorLine(source: []const u8, indicator_index: usize) void {
1002 const line_begin_index = if (std.mem.lastIndexOfScalar(u8, source[0..indicator_index], '\n')) |line_begin|
1002 const line_begin_index = if (std.mem.findScalarLast(u8, source[0..indicator_index], '\n')) |line_begin|
10031003 line_begin + 1
10041004 else
10051005 0;
lib/std/testing/Smith.zig+1-1
......@@ -52,7 +52,7 @@ pub inline fn baselineWeights(T: type) []const Weight {
5252 .bool, .int, .float => i: {
5353 // Reject types that don't have a fixed bitsize (esp. usize)
5454 // since they are not gauraunteed to fit in a u64 across targets.
55 if (std.mem.indexOfScalar(type, &.{
55 if (std.mem.findScalar(type, &.{
5656 isize, usize,
5757 c_char, c_longdouble,
5858 c_short, c_ushort,
lib/std/zig.zig+1-1
......@@ -1560,7 +1560,7 @@ pub fn resolvePath(
15601560 // Heuristic for a fast path: if no component is absolute and ".." never appears, we just need to resolve `paths`.
15611561 for (paths) |p| {
15621562 if (Dir.path.isAbsolute(p)) break; // absolute path
1563 if (mem.indexOf(u8, p, "..") != null) break; // may contain up-dir
1563 if (mem.find(u8, p, "..") != null) break; // may contain up-dir
15641564 } else {
15651565 // no absolute path, no "..".
15661566 const res = try Dir.path.resolve(gpa, paths);
lib/std/zig/Ast/Render.zig+5-5
......@@ -941,20 +941,20 @@ fn renderExpressionFixup(r: *Render, node: Ast.Node.Index, space: Space) Error!v
941941}
942942
943943fn drainNoNewline(w: *Writer, data: []const []const u8, splat: usize) Writer.Error!usize {
944 if (std.mem.indexOfScalar(u8, w.buffered(), '\n') != null) {
944 if (std.mem.findScalar(u8, w.buffered(), '\n') != null) {
945945 return error.WriteFailed;
946946 }
947947
948948 var n: usize = 0;
949949 for (data[0 .. data.len - 1]) |v| {
950 if (std.mem.indexOfScalar(u8, v, '\n') != null) {
950 if (std.mem.findScalar(u8, v, '\n') != null) {
951951 return error.WriteFailed;
952952 }
953953 n += v.len;
954954 }
955955
956956 const pattern = data[data.len - 1];
957 if (splat != 0 and std.mem.indexOfScalar(u8, pattern, '\n') != null) {
957 if (splat != 0 and std.mem.findScalar(u8, pattern, '\n') != null) {
958958 return error.WriteFailed;
959959 }
960960 n += pattern.len * splat;
......@@ -990,7 +990,7 @@ fn rendersMultiline(r: *const Render, node: Ast.Node.Index) error{OutOfMemory}!b
990990 error.WriteFailed => return true,
991991 };
992992 if (sub_ais.disabled_offset != null) return true;
993 if (std.mem.indexOfScalar(u8, no_nl_w.buffered(), '\n') != null) {
993 if (std.mem.findScalar(u8, no_nl_w.buffered(), '\n') != null) {
994994 return true;
995995 }
996996
......@@ -2993,7 +2993,7 @@ fn hasMultilineString(tree: Ast, start_token: Ast.TokenIndex, end_token: Ast.Tok
29932993/// Returns true if there exists a doc comment between the start
29942994/// of token `start_token` and the start of token `end_token`.
29952995fn hasDocComment(tree: Ast, start_token: Ast.TokenIndex, end_token: Ast.TokenIndex) bool {
2996 return std.mem.indexOfScalar(
2996 return std.mem.findScalar(
29972997 Token.Tag,
29982998 tree.tokens.items(.tag)[start_token..end_token],
29992999 .doc_comment,
lib/std/zig/llvm/Builder.zig+1-1
......@@ -9919,7 +9919,7 @@ pub fn attrs(self: *Builder, attributes: []Attribute.Index) Allocator.Error!Attr
99199919pub fn fnAttrs(self: *Builder, fn_attributes: []const Attributes) Allocator.Error!FunctionAttributes {
99209920 try self.function_attributes_set.ensureUnusedCapacity(self.gpa, 1);
99219921 const function_attributes: FunctionAttributes = @fromBackingInt(try self.attrGeneric(@ptrCast(
9922 fn_attributes[0..if (std.mem.lastIndexOfNone(Attributes, fn_attributes, &.{.none})) |last|
9922 fn_attributes[0..if (std.mem.findLastNone(Attributes, fn_attributes, &.{.none})) |last|
99239923 last + 1
99249924 else
99259925 0],
lib/std/zip.zig+1-1
......@@ -109,7 +109,7 @@ pub const EndRecord = extern struct {
109109
110110 /// TODO audit this logic
111111 pub fn findBuffer(buffer: []const u8) FindBufferError!EndRecord {
112 const pos = std.mem.lastIndexOf(u8, buffer, &end_record_sig) orelse return error.ZipNoEndRecord;
112 const pos = std.mem.findLast(u8, buffer, &end_record_sig) orelse return error.ZipNoEndRecord;
113113 if (pos + @sizeOf(EndRecord) > buffer.len) return error.EndOfStream;
114114 const record_ptr: *EndRecord = @ptrCast(buffer[pos..][0..@sizeOf(EndRecord)]);
115115 var record = record_ptr.*;
src/Air.zig+1-1
......@@ -1907,7 +1907,7 @@ pub const NullTerminatedString = enum(u32) {
19071907 pub fn toSlice(nts: NullTerminatedString, air: Air) [:0]const u8 {
19081908 if (nts == .none) return "";
19091909 const bytes = std.mem.sliceAsBytes(air.extra.items[@backingInt(nts)..]);
1910 return bytes[0..std.mem.indexOfScalar(u8, bytes, 0).? :0];
1910 return bytes[0..std.mem.findScalar(u8, bytes, 0).? :0];
19111911 }
19121912};
19131913
src/IncrementalDebugServer.zig+4-4
......@@ -130,7 +130,7 @@ fn serveStream(
130130 try stream_writer.writeAll("zig> ");
131131 const untrimmed = try stream_reader.takeSentinel('\n');
132132 const cmd_and_arg = std.mem.trim(u8, untrimmed, " \t\r\n");
133 const cmd: []const u8, const arg: []const u8 = if (std.mem.indexOfScalar(u8, cmd_and_arg, ' ')) |i|
133 const cmd: []const u8, const arg: []const u8 = if (std.mem.findScalar(u8, cmd_and_arg, ' ')) |i|
134134 .{ cmd_and_arg[0..i], cmd_and_arg[i + 1 ..] }
135135 else
136136 .{ cmd_and_arg, "" };
......@@ -244,7 +244,7 @@ fn handleCommand(zcu: *Zcu, w: *Io.Writer, cmd_str: []const u8, arg_str: []const
244244 const ty: Type = .fromInterned(type_ip_index);
245245 const ty_name = ty.containerTypeName(ip).toSlice(ip);
246246 const success = switch (@as(u2, @intFromBool(anchor_start)) << 1 | @intFromBool(anchor_end)) {
247 0b00 => std.mem.indexOf(u8, ty_name, query) != null,
247 0b00 => std.mem.find(u8, ty_name, query) != null,
248248 0b01 => std.mem.endsWith(u8, ty_name, query),
249249 0b10 => std.mem.startsWith(u8, ty_name, query),
250250 0b11 => std.mem.eql(u8, ty_name, query),
......@@ -265,7 +265,7 @@ fn handleCommand(zcu: *Zcu, w: *Io.Writer, cmd_str: []const u8, arg_str: []const
265265 const nav = ip.getNav(nav_index);
266266 const nav_fqn = nav.fqn.toSlice(ip);
267267 const success = switch (@as(u2, @intFromBool(anchor_start)) << 1 | @intFromBool(anchor_end)) {
268 0b00 => std.mem.indexOf(u8, nav_fqn, query) != null,
268 0b00 => std.mem.find(u8, nav_fqn, query) != null,
269269 0b01 => std.mem.endsWith(u8, nav_fqn, query),
270270 0b10 => std.mem.startsWith(u8, nav_fqn, query),
271271 0b11 => std.mem.eql(u8, nav_fqn, query),
......@@ -378,7 +378,7 @@ fn parseIndex(str: []const u8) ?u32 {
378378 return std.fmt.parseInt(u32, str, 10) catch null;
379379}
380380fn parseAnalUnit(str: []const u8) ?AnalUnit {
381 const split_idx = std.mem.indexOfScalar(u8, str, ' ') orelse return null;
381 const split_idx = std.mem.findScalar(u8, str, ' ') orelse return null;
382382 const kind = str[0..split_idx];
383383 const idx_str = str[split_idx + 1 ..];
384384 if (std.mem.eql(u8, kind, "comptime")) {
src/InternPool.zig+3-3
......@@ -1737,7 +1737,7 @@ pub const String = enum(u32) {
17371737 }
17381738
17391739 pub fn toNullTerminatedString(string: String, len: u64, ip: *const InternPool) NullTerminatedString {
1740 assert(std.mem.indexOfScalar(u8, string.toSlice(len, ip), 0) == null);
1740 assert(std.mem.findScalar(u8, string.toSlice(len, ip), 0) == null);
17411741 assert(string.at(len, ip) == 0);
17421742 return @fromBackingInt(@intCast(@backingInt(string)));
17431743 }
......@@ -1864,7 +1864,7 @@ pub const NullTerminatedString = enum(u32) {
18641864 pub fn toUnsigned(string: NullTerminatedString, ip: *const InternPool) ?u32 {
18651865 const slice = string.toSlice(ip);
18661866 if (slice.len > 1 and slice[0] == '0') return null;
1867 if (std.mem.indexOfScalar(u8, slice, '_')) |_| return null;
1867 if (std.mem.findScalar(u8, slice, '_')) |_| return null;
18681868 return std.fmt.parseUnsigned(u32, slice, 10) catch null;
18691869 }
18701870
......@@ -11428,7 +11428,7 @@ pub fn getOrPutTrailingString(
1142811428 .tid = tid,
1142911429 .index = strings.mutate.len - 1,
1143011430 }).wrap(ip))));
11431 const has_embedded_null = std.mem.indexOfScalar(u8, key, 0) != null;
11431 const has_embedded_null = std.mem.findScalar(u8, key, 0) != null;
1143211432 switch (embedded_nulls) {
1143311433 .no_embedded_nulls => assert(!has_embedded_null),
1143411434 .maybe_embedded_nulls => if (has_embedded_null) {
src/Sema.zig+1-1
......@@ -34856,7 +34856,7 @@ pub fn resolveNavPtrModifiers(
3485634856 const linksection_body = zir_decl.linksection_body orelse break :ls .none;
3485734857 const linksection_ref = try sema.resolveInlineBody(block, linksection_body, decl_inst);
3485834858 const bytes = try sema.toConstString(block, section_src, linksection_ref, .{ .simple = .@"linksection" });
34859 if (std.mem.indexOfScalar(u8, bytes, 0) != null) {
34859 if (std.mem.findScalar(u8, bytes, 0) != null) {
3486034860 return sema.fail(block, section_src, "linksection cannot contain null bytes", .{});
3486134861 } else if (bytes.len == 0) {
3486234862 return sema.fail(block, section_src, "linksection cannot be empty", .{});
src/Value.zig+1-1
......@@ -954,7 +954,7 @@ pub fn anyScalarIsZero(val: Value, zcu: *Zcu) bool {
954954 .bytes => |str| {
955955 const len = Type.fromInterned(agg.ty).vectorLen(zcu);
956956 const slice = str.toSlice(len, &zcu.intern_pool);
957 return std.mem.indexOfScalar(u8, slice, 0) != null;
957 return std.mem.findScalar(u8, slice, 0) != null;
958958 },
959959 .elems => |elems| {
960960 for (elems) |elem| {
src/Zcu.zig+2-2
......@@ -652,7 +652,7 @@ pub const StdLangDecl = enum {
652652 return switch (decl) {
653653 inline else => |tag| {
654654 const name = @tagName(tag);
655 const split = (comptime std.mem.lastIndexOfScalar(u8, name, '.')) orelse return .{ .direct = name };
655 const split = (comptime std.mem.findScalarLast(u8, name, '.')) orelse return .{ .direct = name };
656656 const parent = @field(StdLangDecl, name[0..split]);
657657 comptime assert(@backingInt(parent) < @backingInt(tag)); // dependencies ordered correctly
658658 return .{ .nested = .{ parent, name[split + 1 ..] } };
......@@ -4299,7 +4299,7 @@ fn resolveReferencesInner(zcu: *Zcu) Allocator.Error!std.array_hash_map.Auto(Ana
42994299 const fqn_slice = nav.fqn.toSlice(ip);
43004300 if (comp.test_filters.len > 0) {
43014301 for (comp.test_filters) |test_filter| {
4302 if (std.mem.indexOf(u8, fqn_slice, test_filter) != null) break;
4302 if (std.mem.find(u8, fqn_slice, test_filter) != null) break;
43034303 } else break :a false;
43044304 }
43054305 break :a true;
src/Zcu/PerThread.zig+1-1
......@@ -3176,7 +3176,7 @@ const ScanDeclIter = struct {
31763176 if (is_named and comp.test_filters.len > 0) {
31773177 const fqn_slice = fqn.toSlice(ip);
31783178 for (comp.test_filters) |test_filter| {
3179 if (std.mem.indexOf(u8, fqn_slice, test_filter) != null) break;
3179 if (std.mem.find(u8, fqn_slice, test_filter) != null) break;
31803180 } else break :a false;
31813181 }
31823182 try zcu.test_functions.put(gpa, nav, {});
src/codegen/aarch64/Assemble.zig+1-1
......@@ -163,7 +163,7 @@ const matchers = matchers: {
163163 arg.* = zonCast(param_type.?, instruction.encode[encode_index], symbols);
164164 return @call(.auto, encode, args);
165165 } else if (pattern_token[0] == '<') {
166 const symbol_name = comptime pattern_token[1 .. std.mem.indexOfScalarPos(u8, pattern_token, 1, '|') orelse
166 const symbol_name = comptime pattern_token[1 .. std.mem.findScalarPos(u8, pattern_token, 1, '|') orelse
167167 pattern_token.len - 1];
168168 const symbol = @field(Symbol, symbol_name);
169169 const symbol_ptr = &@field(symbols, symbol_name);
src/codegen/aarch64/Select.zig+1-1
......@@ -2856,7 +2856,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
28562856 const remaining_source = std.mem.span(as.source);
28572857 return isel.fail("unable to assemble: '{s}'", .{std.mem.trim(
28582858 u8,
2859 as.source[0 .. std.mem.indexOfScalar(u8, remaining_source, '\n') orelse remaining_source.len],
2859 as.source[0 .. std.mem.findScalar(u8, remaining_source, '\n') orelse remaining_source.len],
28602860 &std.ascii.whitespace,
28612861 )});
28622862 },
src/codegen/c.zig+2-2
......@@ -5013,7 +5013,7 @@ fn airAsm(f: *Function, inst: Air.Inst.Index) !CValue {
50135013 while (it.next()) |input| {
50145014 const constraint = input.constraint;
50155015
5016 if (constraint.len < 1 or mem.indexOfScalar(u8, "=+&%", constraint[0]) != null or
5016 if (constraint.len < 1 or mem.findScalar(u8, "=+&%", constraint[0]) != null or
50175017 (constraint[0] == '{' and constraint[constraint.len - 1] != '}'))
50185018 {
50195019 return f.fail("CBE: constraint not supported: '{s}'", .{constraint});
......@@ -5077,7 +5077,7 @@ fn airAsm(f: *Function, inst: Air.Inst.Index) !CValue {
50775077 }
50785078
50795079 const desc = mem.sliceTo(asm_source[src_i..], ']');
5080 if (mem.indexOfScalar(u8, desc, ':')) |colon| {
5080 if (mem.findScalar(u8, desc, ':')) |colon| {
50815081 const name = desc[0..colon];
50825082 const modifier = desc[colon + 1 ..];
50835083
src/codegen/riscv64/CodeGen.zig+3-3
......@@ -6235,8 +6235,8 @@ fn airAsm(func: *Func, inst: Air.Inst.Index) !void {
62356235 next_op: for (&ops) |*op| {
62366236 const op_str = while (!last_op) {
62376237 const full_str = op_it.next() orelse break :next_op;
6238 const code_str = if (mem.indexOfScalar(u8, full_str, '#') orelse
6239 mem.indexOf(u8, full_str, "//")) |comment|
6238 const code_str = if (mem.findScalar(u8, full_str, '#') orelse
6239 mem.find(u8, full_str, "//")) |comment|
62406240 code: {
62416241 last_op = true;
62426242 break :code full_str[0..comment];
......@@ -6250,7 +6250,7 @@ fn airAsm(func: *Func, inst: Air.Inst.Index) !void {
62506250 } else if (std.fmt.parseInt(i12, op_str, 10)) |int| {
62516251 op.* = .{ .imm = Immediate.s(int) };
62526252 } else |_| if (mem.startsWith(u8, op_str, "%[")) {
6253 const mod_index = mem.indexOf(u8, op_str, "]@");
6253 const mod_index = mem.find(u8, op_str, "]@");
62546254 const modifier = if (mod_index) |index|
62556255 op_str[index + "]@".len ..]
62566256 else
src/codegen/x86_64/CodeGen.zig+15-15
......@@ -177899,7 +177899,7 @@ fn airAsm(self: *CodeGen, inst: Air.Inst.Index) !void {
177899177899 else if (std.mem.endsWith(u8, mnem_str, "l"))
177900177900 .dword
177901177901 else if (std.mem.endsWith(u8, mnem_str, "q") and
177902 (std.mem.indexOfScalar(u8, "vp", mnem_str[0]) == null or
177902 (std.mem.findScalar(u8, "vp", mnem_str[0]) == null or
177903177903 !std.mem.endsWith(u8, mnem_str, "dq")))
177904177904 .qword
177905177905 else if (std.mem.endsWith(u8, mnem_str, "t"))
......@@ -177966,8 +177966,8 @@ fn airAsm(self: *CodeGen, inst: Air.Inst.Index) !void {
177966177966 }) + 1,
177967177967 }
177968177968 };
177969 const untrimmed_op_str = if (std.mem.indexOfScalar(u8, full_op_str, '#') orelse
177970 std.mem.indexOf(u8, full_op_str, "//")) |comment|
177969 const untrimmed_op_str = if (std.mem.findScalar(u8, full_op_str, '#') orelse
177970 std.mem.find(u8, full_op_str, "//")) |comment|
177971177971 untrimmed_op_str: {
177972177972 ops_index = ops_str.len;
177973177973 break :untrimmed_op_str full_op_str[0..comment];
......@@ -177976,7 +177976,7 @@ fn airAsm(self: *CodeGen, inst: Air.Inst.Index) !void {
177976177976 if (trimmed_op_str.len > 0) break trimmed_op_str;
177977177977 };
177978177978 if (std.mem.startsWith(u8, op_str, "%%")) {
177979 const colon = std.mem.indexOfScalarPos(u8, op_str, "%%".len + 2, ':');
177979 const colon = std.mem.findScalarPos(u8, op_str, "%%".len + 2, ':');
177980177980 const reg = parseRegName(op_str["%%".len .. colon orelse op_str.len]) orelse
177981177981 return self.fail("invalid register: '{s}'", .{op_str});
177982177982 if (colon) |colon_pos| {
......@@ -177997,7 +177997,7 @@ fn airAsm(self: *CodeGen, inst: Air.Inst.Index) !void {
177997177997 op.* = .{ .reg = reg };
177998177998 }
177999177999 } else if (std.mem.startsWith(u8, op_str, "%[") and std.mem.endsWith(u8, op_str, "]")) {
178000 const colon = std.mem.indexOfScalarPos(u8, op_str, "%[".len, ':');
178000 const colon = std.mem.findScalarPos(u8, op_str, "%[".len, ':');
178001178001 const modifier = if (colon) |colon_pos|
178002178002 op_str[colon_pos + ":".len .. op_str.len - "]".len]
178003178003 else
......@@ -178080,7 +178080,7 @@ fn airAsm(self: *CodeGen, inst: Air.Inst.Index) !void {
178080178080 else |_|
178081178081 return self.fail("invalid immediate: '{s}'", .{op_str});
178082178082 } else if (std.mem.endsWith(u8, op_str, ")")) {
178083 const open = std.mem.indexOfScalar(u8, op_str, '(') orelse
178083 const open = std.mem.findScalar(u8, op_str, '(') orelse
178084178084 return self.fail("invalid operand: '{s}'", .{op_str});
178085178085 var sib_it =
178086178086 std.mem.splitScalar(u8, op_str[open + "(".len .. op_str.len - ")".len], ',');
......@@ -178141,7 +178141,7 @@ fn airAsm(self: *CodeGen, inst: Air.Inst.Index) !void {
178141178141 .disp = if (std.mem.startsWith(u8, op_str[0..open], "%[") and
178142178142 std.mem.endsWith(u8, op_str[0..open], "]"))
178143178143 disp: {
178144 const colon = std.mem.indexOfScalarPos(u8, op_str[0..open], "%[".len, ':');
178144 const colon = std.mem.findScalarPos(u8, op_str[0..open], "%[".len, ':');
178145178145 const modifier = if (colon) |colon_pos|
178146178146 op_str[colon_pos + ":".len .. open - "]".len]
178147178147 else
......@@ -178210,14 +178210,14 @@ fn airAsm(self: *CodeGen, inst: Air.Inst.Index) !void {
178210178210 .{ ._, .pseudo }
178211178211 else for (std.enums.values(Mir.Inst.Fixes)) |fixes| {
178212178212 const fixes_name = @tagName(fixes);
178213 const space_index = std.mem.indexOfScalar(u8, fixes_name, ' ');
178213 const space_index = std.mem.findScalar(u8, fixes_name, ' ');
178214178214 const fixes_prefix = if (space_index) |index|
178215178215 std.meta.stringToEnum(encoder.Instruction.Prefix, fixes_name[0..index]).?
178216178216 else
178217178217 .none;
178218178218 if (fixes_prefix != prefix) continue;
178219178219 const pattern = fixes_name[if (space_index) |index| index + " ".len else 0..];
178220 const wildcard_index = std.mem.indexOfScalar(u8, pattern, '_').?;
178220 const wildcard_index = std.mem.findScalar(u8, pattern, '_').?;
178221178221 const mnem_prefix = pattern[0..wildcard_index];
178222178222 const mnem_suffix = pattern[wildcard_index + "_".len ..];
178223178223 if (!std.mem.startsWith(u8, mnem_name, mnem_prefix)) continue;
......@@ -178463,11 +178463,11 @@ fn moveStrategy(cg: *CodeGen, ty: Type, class: Register.Class, aligned: bool) !M
178463178463 .sse => switch (ty.zigTypeTag(zcu)) {
178464178464 else => {
178465178465 const classes = std.mem.sliceTo(&abi.classifySystemV(ty, zcu, cg.target, .other), .none);
178466 assert(std.mem.indexOfNone(abi.Class, classes, &.{
178466 assert(std.mem.findNone(abi.Class, classes, &.{
178467178467 .integer, .sse, .sseup, .memory, .float, .float_combine,
178468178468 }) == null);
178469178469 const abi_size = ty.abiSize(zcu);
178470 if (abi_size < 4 or std.mem.indexOfScalar(abi.Class, classes, .integer) != null) switch (abi_size) {
178470 if (abi_size < 4 or std.mem.findScalar(abi.Class, classes, .integer) != null) switch (abi_size) {
178471178471 1 => return if (cg.hasFeature(.avx)) .{ .vex_insert_extract = .{
178472178472 .insert = .{ .vp_b, .insr },
178473178473 .extract = .{ .vp_b, .extr },
......@@ -183578,8 +183578,8 @@ const Temp = struct {
183578183578 const class = classes[class_index];
183579183579 next_class_index = @intCast(switch (class) {
183580183580 .integer, .memory, .float, .float_combine => class_index + 1,
183581 .sse => std.mem.indexOfNonePos(abi.Class, classes, class_index + 1, &.{.sseup}) orelse classes.len,
183582 .x87 => std.mem.indexOfNonePos(abi.Class, classes, class_index + 1, &.{.x87up}) orelse classes.len,
183581 .sse => std.mem.findNonePos(abi.Class, classes, class_index + 1, &.{.sseup}) orelse classes.len,
183582 .x87 => std.mem.findNonePos(abi.Class, classes, class_index + 1, &.{.x87up}) orelse classes.len,
183583183583 .sseup,
183584183584 .x87up,
183585183585 .none,
......@@ -189825,7 +189825,7 @@ const Select = struct {
189825189825 s.cg.asmOps(mir_tag, mir_ops) catch |err| switch (err) {
189826189826 error.InvalidInstruction => {
189827189827 const fixes = @tagName(mir_tag[0]);
189828 const fixes_blank = std.mem.indexOfScalar(u8, fixes, '_').?;
189828 const fixes_blank = std.mem.findScalar(u8, fixes, '_').?;
189829189829 return s.cg.fail("invalid instruction: '{s}{s}{s} {s} {s} {s} {s}'", .{
189830189830 fixes[0..fixes_blank],
189831189831 @tagName(mir_tag[1]),
......@@ -189905,7 +189905,7 @@ const Select = struct {
189905189905 .add, .com, .comi, .div, .divr, .mul, .st, .sub, .subr, .ucom, .ucomi => s.top +%= 1,
189906189906 else => {
189907189907 const fixes = @tagName(mir_tag[0]);
189908 const fixes_blank = std.mem.indexOfScalar(u8, fixes, '_').?;
189908 const fixes_blank = std.mem.findScalar(u8, fixes, '_').?;
189909189909 std.debug.panic("{s}: {s}{s}{s}\n", .{
189910189910 @src().fn_name,
189911189911 fixes[0..fixes_blank],
src/codegen/x86_64/Lower.zig+5-5
......@@ -435,11 +435,11 @@ const mnemonic_table: [inst_tags_len * inst_fixes_len]?Mnemonic = table: {
435435 for (0..inst_fixes_len) |fixes_i| {
436436 const fixes: Mir.Inst.Fixes = @fromBackingInt(@intCast(fixes_i));
437437 const prefix, const suffix = affix: {
438 const pattern = if (std.mem.indexOfScalar(u8, @tagName(fixes), ' ')) |i|
438 const pattern = if (std.mem.findScalar(u8, @tagName(fixes), ' ')) |i|
439439 @tagName(fixes)[i + 1 ..]
440440 else
441441 @tagName(fixes);
442 const wildcard_idx = std.mem.indexOfScalar(u8, pattern, '_').?;
442 const wildcard_idx = std.mem.findScalar(u8, pattern, '_').?;
443443 break :affix .{ pattern[0..wildcard_idx], pattern[wildcard_idx + 1 ..] };
444444 };
445445 for (0..inst_tags_len) |inst_tag_i| {
......@@ -477,7 +477,7 @@ fn generic(lower: *Lower, inst: Mir.Inst) Error!void {
477477 else => return lower.fail("TODO lower .{s}", .{@tagName(inst.ops)}),
478478 };
479479 try lower.encode(switch (fixes) {
480 inline else => |tag| comptime if (std.mem.indexOfScalar(u8, @tagName(tag), ' ')) |space|
480 inline else => |tag| comptime if (std.mem.findScalar(u8, @tagName(tag), ' ')) |space|
481481 @field(Prefix, @tagName(tag)[0..space])
482482 else
483483 .none,
......@@ -487,8 +487,8 @@ fn generic(lower: *Lower, inst: Mir.Inst) Error!void {
487487 }
488488 // This combination is invalid; make the theoretical mnemonic name and emit an error with it.
489489 const fixes_name = @tagName(fixes);
490 const pattern = fixes_name[if (std.mem.indexOfScalar(u8, fixes_name, ' ')) |i| i + " ".len else 0..];
491 const wildcard_index = std.mem.indexOfScalar(u8, pattern, '_').?;
490 const pattern = fixes_name[if (std.mem.findScalar(u8, fixes_name, ' ')) |i| i + " ".len else 0..];
491 const wildcard_index = std.mem.findScalar(u8, pattern, '_').?;
492492 return lower.fail("unsupported mnemonic: '{s}{s}{s}'", .{
493493 pattern[0..wildcard_index],
494494 @tagName(inst.tag),
src/codegen/x86_64/Mir.zig+3-3
......@@ -1745,8 +1745,8 @@ pub const Inst = struct {
17451745 for (@typeInfo(Mnemonic).@"enum".field_names) |mnemonic_name| {
17461746 if (mnemonic_name[0] == '.') continue;
17471747 for (@typeInfo(Fixes).@"enum".field_names) |fixes_name| {
1748 const pattern = fixes_name[if (std.mem.indexOfScalar(u8, fixes_name, ' ')) |index| index + " ".len else 0..];
1749 const wildcard_index = std.mem.indexOfScalar(u8, pattern, '_').?;
1748 const pattern = fixes_name[if (std.mem.findScalar(u8, fixes_name, ' ')) |index| index + " ".len else 0..];
1749 const wildcard_index = std.mem.findScalar(u8, pattern, '_').?;
17501750 const mnem_prefix = pattern[0..wildcard_index];
17511751 const mnem_suffix = pattern[wildcard_index + "_".len ..];
17521752 if (!std.mem.startsWith(u8, mnemonic_name, mnem_prefix)) continue;
......@@ -1823,7 +1823,7 @@ pub const NullTerminatedString = enum(u32) {
18231823 pub fn toSlice(nts: NullTerminatedString, mir: *const Mir) ?[:0]const u8 {
18241824 if (nts == .none) return null;
18251825 const string_bytes = mir.string_bytes[@backingInt(nts)..];
1826 return string_bytes[0..std.mem.indexOfScalar(u8, string_bytes, 0).? :0];
1826 return string_bytes[0..std.mem.findScalar(u8, string_bytes, 0).? :0];
18271827 }
18281828};
18291829
src/codegen/x86_64/abi.zig+1-1
......@@ -318,7 +318,7 @@ pub fn classifySystemV(ty: Type, zcu: *Zcu, target: *const std.Target, ctx: Cont
318318 // byte isn't SSE or any other eightbyte isn't SSEUP, the whole argument
319319 // is passed in memory."
320320 if (ty_size > 16 and (result[0] != .sse or
321 std.mem.indexOfNone(Class, result[1..], &.{ .sseup, .none }) != null)) return Class.stack;
321 std.mem.findNone(Class, result[1..], &.{ .sseup, .none }) != null)) return Class.stack;
322322
323323 // "If SSEUP is not preceded by SSE or SSEUP, it is converted to SSE."
324324 for (&result, 0..) |*class, i| switch (class.*) {
src/codegen/x86_64/encoder.zig+1-1
......@@ -1171,7 +1171,7 @@ fn expectEqualHexStrings(expected: []const u8, given: []const u8, assembly: []co
11711171 defer testing.allocator.free(expected_fmt);
11721172 const given_fmt = try std.fmt.allocPrint(testing.allocator, "{x}", .{given});
11731173 defer testing.allocator.free(given_fmt);
1174 const idx = std.mem.indexOfDiff(u8, expected_fmt, given_fmt).?;
1174 const idx = std.mem.findDiff(u8, expected_fmt, given_fmt).?;
11751175 const padding = try testing.allocator.alloc(u8, idx + 5);
11761176 defer testing.allocator.free(padding);
11771177 @memset(padding, ' ');
src/libs/mingw/Preprocessor.zig+2-2
......@@ -15,7 +15,7 @@ const RawTokenList = std.ArrayList(Token);
1515const ExpandBuf = std.ArrayList(Token);
1616
1717const Preprocessor = @This();
18const DefineMap = std.StringArrayHashMapUnmanaged(Macro);
18const DefineMap = std.array_hash_map.String(Macro);
1919
2020const GeneratedTokens = std.ArrayList(u8);
2121
......@@ -29,7 +29,7 @@ pub const Source = struct {
2929 buf: []const u8,
3030};
3131
32sources: std.StringArrayHashMapUnmanaged(Source) = .empty,
32sources: std.array_hash_map.String(Source) = .empty,
3333
3434arena: Allocator,
3535io: std.Io,
src/libs/mingw/def.zig+4-4
......@@ -61,7 +61,7 @@ pub const ModuleDefinition = struct {
6161 // or ? for C++ functions). Vectorcall functions won't have any
6262 // fixed prefix, but the function base name will still be at least
6363 // one char.
64 const name_len_without_at_suffix = std.mem.indexOfScalarPos(u8, e.name, 1, '@') orelse e.name.len;
64 const name_len_without_at_suffix = std.mem.findScalarPos(u8, e.name, 1, '@') orelse e.name.len;
6565 e.name = e.name[0..name_len_without_at_suffix];
6666 }
6767 }
......@@ -452,7 +452,7 @@ pub const Parser = struct {
452452 var ext_name_needs_underscore = false;
453453 if (self.machine_type == .I386) {
454454 const is_decorated = isDecorated(name_tok.slice(self.tokenizer.source), self.module_definition_type);
455 const is_forward_target = ext_name_tok != null and std.mem.indexOfScalar(u8, name_tok.slice(self.tokenizer.source), '.') != null;
455 const is_forward_target = ext_name_tok != null and std.mem.findScalar(u8, name_tok.slice(self.tokenizer.source), '.') != null;
456456 name_needs_underscore = !is_decorated and !is_forward_target;
457457
458458 if (ext_name_tok) |ext_name| {
......@@ -578,9 +578,9 @@ pub const Parser = struct {
578578 // themselves can start with an underscore, while a second one still needs
579579 // to be added.
580580 if (std.mem.startsWith(u8, symbol, "@")) return true;
581 if (std.mem.indexOf(u8, symbol, "@@") != null) return true;
581 if (std.mem.find(u8, symbol, "@@") != null) return true;
582582 if (std.mem.startsWith(u8, symbol, "?")) return true;
583 if (module_definition_type != .mingw and std.mem.indexOfScalar(u8, symbol, '@') != null) return true;
583 if (module_definition_type != .mingw and std.mem.findScalar(u8, symbol, '@') != null) return true;
584584 return false;
585585 }
586586
src/libs/mingw/implib.zig+1-1
......@@ -351,7 +351,7 @@ fn getNameType(
351351 // the leading underscore. In MinGW on the other hand, a decorated
352352 // stdcall function still omits the underscore (IMPORT_NAME_NOPREFIX).
353353 if (std.mem.startsWith(u8, ext_name, "_") and
354 std.mem.indexOfScalar(u8, ext_name, '@') != null and
354 std.mem.findScalar(u8, ext_name, '@') != null and
355355 module_definition_type != .mingw)
356356 return .NAME;
357357 if (!std.mem.eql(u8, symbol, ext_name))
src/link/Coff.zig+7-7
......@@ -621,7 +621,7 @@ pub const LongNamesTable = struct {
621621 }
622622
623623 pub fn hash(_: Adapter, key: []const u8) u32 {
624 assert(std.mem.indexOfScalar(u8, key, 0) == null);
624 assert(std.mem.findScalar(u8, key, 0) == null);
625625 return std.array_hash_map.hashString(key);
626626 }
627627 };
......@@ -711,7 +711,7 @@ pub const ExportTable = struct {
711711 }
712712
713713 pub fn hash(_: Adapter, key: []const u8) u32 {
714 assert(std.mem.indexOfScalar(u8, key, 0) == null);
714 assert(std.mem.findScalar(u8, key, 0) == null);
715715 return std.array_hash_map.hashString(key);
716716 }
717717 };
......@@ -759,7 +759,7 @@ pub const ImportTable = struct {
759759 }
760760
761761 pub fn hash(_: Adapter, key: []const u8) u32 {
762 assert(std.mem.indexOfScalar(u8, key, 0) == null);
762 assert(std.mem.findScalar(u8, key, 0) == null);
763763 return std.array_hash_map.hashString(key);
764764 }
765765 };
......@@ -822,7 +822,7 @@ pub const String = enum(u32) {
822822
823823 pub fn toSlice(s: String, coff: *Coff) [:0]const u8 {
824824 const slice = coff.string_bytes.items[@backingInt(s)..];
825 return slice[0..std.mem.indexOfScalar(u8, slice, 0).? :0];
825 return slice[0..std.mem.findScalar(u8, slice, 0).? :0];
826826 }
827827
828828 pub fn toOptional(s: String) String.Optional {
......@@ -3535,7 +3535,7 @@ fn objectSectionParentName(coff: *Coff, name: []const u8) []const u8 {
35353535 // Otherwise, we want to keep the full name so that this sort can occur correctly when
35363536 // the object is finally linked into an image.
35373537 return if (coff.isImage())
3538 name[0 .. std.mem.indexOfScalar(u8, name, '$') orelse name.len]
3538 name[0 .. std.mem.findScalar(u8, name, '$') orelse name.len]
35393539 else
35403540 name;
35413541}
......@@ -5737,7 +5737,7 @@ fn reportUndefs(coff: *Coff, tid: Zcu.PerThread.Id) !void {
57375737 const gpa = comp.gpa;
57385738 const max_notes = 4;
57395739
5740 var undef_indices: std.ArrayListUnmanaged(u32) = .empty;
5740 var undef_indices: std.ArrayList(u32) = .empty;
57415741 for (coff.relocs.items, 0..) |reloc, reloc_i| {
57425742 if (reloc.flags.free) continue;
57435743 const target_sym = reloc.target.get(coff);
......@@ -6987,7 +6987,7 @@ fn flushMoved(coff: *Coff, ni: MappedFile.Node.Index) !void {
69876987 continue;
69886988
69896989 import_hint_name_index = @intCast(import_hint_name_align.forward(
6990 std.mem.indexOfScalarPos(
6990 std.mem.findScalarPos(
69916991 u8,
69926992 import_hint_name_slice,
69936993 import_hint_name_index,
src/link/Elf.zig+3-3
......@@ -2173,7 +2173,7 @@ fn sortInitFini(self: *Elf) !void {
21732173 => is_init_fini = true,
21742174 else => {
21752175 const name = self.getShString(shdr.sh_name);
2176 is_ctor_dtor = mem.indexOf(u8, name, ".ctors") != null or mem.indexOf(u8, name, ".dtors") != null;
2176 is_ctor_dtor = mem.find(u8, name, ".ctors") != null or mem.find(u8, name, ".dtors") != null;
21772177 },
21782178 }
21792179 if (!is_init_fini and !is_ctor_dtor) continue;
......@@ -3702,7 +3702,7 @@ fn shString(
37023702 off: u32,
37033703) [:0]const u8 {
37043704 const slice = shstrtab[off..];
3705 return slice[0..mem.indexOfScalar(u8, slice, 0).? :0];
3705 return slice[0..mem.findScalar(u8, slice, 0).? :0];
37063706}
37073707
37083708pub fn insertShString(self: *Elf, name: [:0]const u8) error{OutOfMemory}!u32 {
......@@ -4376,7 +4376,7 @@ fn createThunks(elf_file: *Elf, atom_list: *AtomList) !void {
43764376
43774377pub fn stringTableLookup(strtab: []const u8, off: u32) [:0]const u8 {
43784378 const slice = strtab[off..];
4379 return slice[0..mem.indexOfScalar(u8, slice, 0).? :0];
4379 return slice[0..mem.findScalar(u8, slice, 0).? :0];
43804380}
43814381
43824382pub fn pwriteAll(elf_file: *Elf, bytes: []const u8, offset: u64) error{AlreadyReported}!void {
src/link/Elf/Archive.zig+1-1
......@@ -118,7 +118,7 @@ pub fn parse(
118118
119119pub fn stringTableLookup(strtab: []const u8, off: u32) [:'\n']const u8 {
120120 const slice = strtab[off..];
121 return slice[0..mem.indexOfScalar(u8, slice, '\n').? :'\n'];
121 return slice[0..mem.findScalar(u8, slice, '\n').? :'\n'];
122122}
123123
124124pub fn setArHdr(opts: struct {
src/link/Elf2.zig+1-1
......@@ -3010,7 +3010,7 @@ const StringTable = struct {
30103010 }
30113011
30123012 pub fn hash(_: Adapter, key: []const u8) u64 {
3013 assert(std.mem.indexOfScalar(u8, key, 0) == null);
3013 assert(std.mem.findScalar(u8, key, 0) == null);
30143014 return std.hash_map.hashString(key);
30153015 }
30163016 };
src/link/MachO.zig+6-6
......@@ -1070,7 +1070,7 @@ fn isHoisted(self: *MachO, install_name: []const u8) bool {
10701070 if (mem.startsWith(u8, dirname, "/usr/lib")) return true;
10711071 if (eatPrefix(dirname, "/System/Library/Frameworks/")) |path| {
10721072 const basename = fs.path.basename(install_name);
1073 if (mem.indexOfScalar(u8, path, '.')) |index| {
1073 if (mem.findScalar(u8, path, '.')) |index| {
10741074 if (mem.eql(u8, basename, path[0..index])) return true;
10751075 }
10761076 }
......@@ -1739,14 +1739,14 @@ fn initSyntheticSections(self: *MachO) !void {
17391739 });
17401740 }
17411741 } else if (eatPrefix(name, "section$start$")) |actual_name| {
1742 const sep = mem.indexOfScalar(u8, actual_name, '$').?; // TODO error rather than a panic
1742 const sep = mem.findScalar(u8, actual_name, '$').?; // TODO error rather than a panic
17431743 const segname = actual_name[0..sep]; // TODO check segname is valid
17441744 const sectname = actual_name[sep + 1 ..]; // TODO check sectname is valid
17451745 if (self.getSectionByName(segname, sectname) == null) {
17461746 _ = try self.addSection(segname, sectname, .{});
17471747 }
17481748 } else if (eatPrefix(name, "section$end$")) |actual_name| {
1749 const sep = mem.indexOfScalar(u8, actual_name, '$').?; // TODO error rather than a panic
1749 const sep = mem.findScalar(u8, actual_name, '$').?; // TODO error rather than a panic
17501750 const segname = actual_name[0..sep]; // TODO check segname is valid
17511751 const sectname = actual_name[sep + 1 ..]; // TODO check sectname is valid
17521752 if (self.getSectionByName(segname, sectname) == null) {
......@@ -1767,7 +1767,7 @@ fn getSegmentProt(segname: []const u8) macho.vm_prot_t {
17671767fn getSegmentRank(segname: []const u8) u8 {
17681768 if (mem.eql(u8, segname, "__PAGEZERO")) return 0x0;
17691769 if (mem.eql(u8, segname, "__LINKEDIT")) return 0xf;
1770 if (mem.indexOf(u8, segname, "ZIG")) |_| return 0xe;
1770 if (mem.find(u8, segname, "ZIG")) |_| return 0xe;
17711771 if (mem.startsWith(u8, segname, "__TEXT")) return 0x1;
17721772 if (mem.startsWith(u8, segname, "__DATA_CONST")) return 0x2;
17731773 if (mem.startsWith(u8, segname, "__DATA")) return 0x3;
......@@ -2342,7 +2342,7 @@ fn allocateSyntheticSymbols(self: *MachO) void {
23422342 }
23432343 } else if (mem.startsWith(u8, name, "section$start$")) {
23442344 const actual_name = name["section$start$".len..];
2345 const sep = mem.indexOfScalar(u8, actual_name, '$').?; // TODO error rather than a panic
2345 const sep = mem.findScalar(u8, actual_name, '$').?; // TODO error rather than a panic
23462346 const segname = actual_name[0..sep];
23472347 const sectname = actual_name[sep + 1 ..];
23482348 if (self.getSectionByName(segname, sectname)) |sect_id| {
......@@ -2352,7 +2352,7 @@ fn allocateSyntheticSymbols(self: *MachO) void {
23522352 }
23532353 } else if (mem.startsWith(u8, name, "section$end$")) {
23542354 const actual_name = name["section$end$".len..];
2355 const sep = mem.indexOfScalar(u8, actual_name, '$').?; // TODO error rather than a panic
2355 const sep = mem.findScalar(u8, actual_name, '$').?; // TODO error rather than a panic
23562356 const segname = actual_name[0..sep];
23572357 const sectname = actual_name[sep + 1 ..];
23582358 if (self.getSectionByName(segname, sectname)) |sect_id| {
src/link/MachO/Archive.zig+2-2
......@@ -45,7 +45,7 @@ pub fn unpack(self: *Archive, macho_file: *MachO, path: Path, handle_index: File
4545 const amt = try handle.readPositionalAll(io, buf, pos);
4646 if (amt != len) return error.InputOutput;
4747 pos += len;
48 const actual_len = mem.indexOfScalar(u8, buf, @as(u8, 0)) orelse len;
48 const actual_len = mem.findScalar(u8, buf, @as(u8, 0)) orelse len;
4949 break :name buf[0..actual_len];
5050 }
5151 unreachable;
......@@ -161,7 +161,7 @@ pub const ar_hdr = extern struct {
161161 fn name(self: *const ar_hdr) ?[]const u8 {
162162 const value = &self.ar_name;
163163 if (mem.startsWith(u8, value, "#1/")) return null;
164 const sentinel = mem.indexOfScalar(u8, value, '/') orelse value.len;
164 const sentinel = mem.findScalar(u8, value, '/') orelse value.len;
165165 return value[0..sentinel];
166166 }
167167
src/link/MachO/Symbol.zig+1-1
......@@ -43,7 +43,7 @@ pub fn isSymbolStab(symbol: Symbol, macho_file: *MachO) bool {
4343
4444pub fn isTlvInit(symbol: Symbol, macho_file: *MachO) bool {
4545 const name = symbol.getName(macho_file);
46 return std.mem.indexOf(u8, name, "$tlv$init") != null;
46 return std.mem.find(u8, name, "$tlv$init") != null;
4747}
4848
4949pub fn weakRef(symbol: Symbol, macho_file: *MachO) bool {
src/link/MachO/dyld_info/Trie.zig+2-2
......@@ -54,7 +54,7 @@ fn putNode(self: *Trie, node_index: Node.Index, allocator: Allocator, label: []c
5454 // Check for match with edges from this node.
5555 for (self.nodes.items(.edges)[node_index].items) |edge_index| {
5656 const edge = &self.edges.items[edge_index];
57 const match = mem.indexOfDiff(u8, edge.label, label) orelse return edge.node;
57 const match = mem.findDiff(u8, edge.label, label) orelse return edge.node;
5858 if (match == 0) continue;
5959 if (match == edge.label.len) return self.putNode(edge.node, allocator, label[match..]);
6060
......@@ -351,7 +351,7 @@ fn expectEqualHexStrings(expected: []const u8, given: []const u8) !void {
351351 defer testing.allocator.free(expected_fmt);
352352 const given_fmt = try std.fmt.allocPrint(testing.allocator, "{x}", .{given});
353353 defer testing.allocator.free(given_fmt);
354 const idx = mem.indexOfDiff(u8, expected_fmt, given_fmt).?;
354 const idx = mem.findDiff(u8, expected_fmt, given_fmt).?;
355355 const padding = try testing.allocator.alloc(u8, idx + 5);
356356 defer testing.allocator.free(padding);
357357 @memset(padding, ' ');
src/link/SpirV.zig+13-13
......@@ -25,10 +25,10 @@ const Mir = @import("../codegen/spirv/Mir.zig");
2525const Linker = @This();
2626
2727base: link.File,
28fragments: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, Mir) = .empty,
29pending_navs: std.ArrayListUnmanaged(InternPool.Nav.Index) = .empty,
30entry_points: std.ArrayListUnmanaged(EntryPointDecl) = .empty,
31external_objects: std.ArrayListUnmanaged(ExternalObject) = .empty,
28fragments: std.array_hash_map.Auto(InternPool.Nav.Index, Mir) = .empty,
29pending_navs: std.ArrayList(InternPool.Nav.Index) = .empty,
30entry_points: std.ArrayList(EntryPointDecl) = .empty,
31external_objects: std.ArrayList(ExternalObject) = .empty,
3232
3333const EntryPointDecl = struct {
3434 nav: InternPool.Nav.Index,
......@@ -363,16 +363,16 @@ fn mergeFragments(linker: *Linker, gpa: Allocator, arena: Allocator) error{OutOf
363363 }
364364
365365 // Resolve Zig extern navs against external objects.
366 var ext_id_offsets: std.ArrayListUnmanaged(Word) = .empty;
366 var ext_id_offsets: std.ArrayList(Word) = .empty;
367367 defer ext_id_offsets.deinit(gpa);
368368 try ext_id_offsets.ensureTotalCapacity(gpa, linker.external_objects.items.len);
369369
370370 var unresolved_extern_count: u32 = 0;
371 var resolved_ids: std.AutoArrayHashMapUnmanaged(Id, void) = .empty;
371 var resolved_ids: std.array_hash_map.Auto(Id, void) = .empty;
372372 defer resolved_ids.deinit(gpa);
373373
374374 if (maybe_ip) |ip| {
375 var extern_name_map: std.StringArrayHashMapUnmanaged(InternPool.Nav.Index) = .empty;
375 var extern_name_map: std.array_hash_map.String(InternPool.Nav.Index) = .empty;
376376 defer extern_name_map.deinit(gpa);
377377
378378 var nav_it = nav_final_ids.iterator();
......@@ -518,14 +518,14 @@ fn mergeZigFragments(
518518 frag_infos: []const FragmentInfo,
519519 nav_final_ids: *const std.AutoHashMapUnmanaged(InternPool.Nav.Index, Id),
520520 uav_final_ids: *const std.AutoHashMapUnmanaged(struct { InternPool.Index, spec.StorageClass }, Id),
521 resolved_ids: *const std.AutoArrayHashMapUnmanaged(Id, void),
521 resolved_ids: *const std.array_hash_map.Auto(Id, void),
522522 maybe_ip: ?*InternPool,
523523) error{OutOfMemory}!void {
524524 for (linker.fragments.values(), frag_infos) |*mir, frag_info| {
525525 var id_remap: std.AutoHashMapUnmanaged(Id, Id) = .empty;
526526 defer id_remap.deinit(gpa);
527527
528 var resolved_local_ids: std.AutoArrayHashMapUnmanaged(Id, void) = .empty;
528 var resolved_local_ids: std.array_hash_map.Auto(Id, void) = .empty;
529529 defer resolved_local_ids.deinit(gpa);
530530
531531 for (mir.nav_refs) |ref| {
......@@ -569,7 +569,7 @@ fn remapFilteredInsts(
569569 id_offset: Word,
570570 id_remap: *const std.AutoHashMapUnmanaged(Id, Id),
571571 parser: *BinaryModule.Parser,
572 skip_ids: *const std.AutoArrayHashMapUnmanaged(Id, void),
572 skip_ids: *const std.array_hash_map.Auto(Id, void),
573573 mode: FilterMode,
574574) error{OutOfMemory}!void {
575575 if (words.len == 0) return;
......@@ -887,9 +887,9 @@ fn appendExternalObjects(
887887 has_linkage: *bool,
888888 keep_entry_points: bool,
889889 is_obj: bool,
890 resolved_ids: *const std.AutoArrayHashMapUnmanaged(Id, void),
890 resolved_ids: *const std.array_hash_map.Auto(Id, void),
891891) error{OutOfMemory}!void {
892 var export_map: std.StringArrayHashMapUnmanaged(Id) = .empty;
892 var export_map: std.array_hash_map.String(Id) = .empty;
893893 defer export_map.deinit(gpa);
894894
895895 for (linker.external_objects.items, ext_id_offsets) |ext_obj, id_offset| {
......@@ -908,7 +908,7 @@ fn appendExternalObjects(
908908 }
909909 for (per_obj_remaps) |*m| m.* = .empty;
910910
911 var resolved_linkage_ids: std.AutoArrayHashMapUnmanaged(Id, void) = .empty;
911 var resolved_linkage_ids: std.array_hash_map.Auto(Id, void) = .empty;
912912 defer resolved_linkage_ids.deinit(gpa);
913913
914914 for (resolved_ids.keys()) |id| {
src/link/SpirV/dedup_types.zig+2-2
......@@ -85,7 +85,7 @@ pub fn run(parser: *BinaryModule.Parser, binary: *BinaryModule) !void {
8585
8686 for (inst.operands, 0..) |word, i| {
8787 if (i == result_id_index) continue;
88 if (std.mem.indexOfScalar(u16, id_offsets.items, @intCast(i)) != null) {
88 if (std.mem.findScalar(u16, id_offsets.items, @intCast(i)) != null) {
8989 const canonical = id_remap.get(@fromBackingInt(@intCast(word))) orelse @as(Id, @fromBackingInt(@intCast(word)));
9090 try key_words.append(gpa, @backingInt(canonical));
9191 } else {
......@@ -182,7 +182,7 @@ pub fn run(parser: *BinaryModule.Parser, binary: *BinaryModule) !void {
182182 } else null;
183183
184184 for (inst_slice, 0..) |*word, i| {
185 if (std.mem.indexOfScalar(u16, id_offsets.items, @intCast(i)) == null) continue;
185 if (std.mem.findScalar(u16, id_offsets.items, @intCast(i)) == null) continue;
186186 max_id = @max(max_id, word.*);
187187 if (maybe_result_id_index != null and i == maybe_result_id_index.?) continue;
188188
src/link/SpirV/prune_unused.zig+1-1
......@@ -187,7 +187,7 @@ fn markAlive(
187187 parser: *BinaryModule.Parser,
188188 binary: BinaryModule,
189189 inst: BinaryModule.Instruction,
190 alive: *std.DynamicBitSetUnmanaged,
190 alive: *std.bit_set.Dynamic,
191191 id_to_index: *const std.AutoHashMapUnmanaged(ResultId, u32),
192192 code_offsets: *const std.ArrayList(usize),
193193 id_offset_buf: *std.ArrayList(u16),
src/link/Wasm.zig+4-4
......@@ -2539,14 +2539,14 @@ pub const String = enum(u32) {
25392539 }
25402540
25412541 pub fn hash(_: @This(), adapted_key: []const u8) u64 {
2542 assert(mem.indexOfScalar(u8, adapted_key, 0) == null);
2542 assert(mem.findScalar(u8, adapted_key, 0) == null);
25432543 return std.hash_map.hashString(adapted_key);
25442544 }
25452545 };
25462546
25472547 pub fn slice(index: String, wasm: *const Wasm) [:0]const u8 {
25482548 const start_slice = wasm.string_bytes.items[@backingInt(index)..];
2549 return start_slice[0..mem.indexOfScalar(u8, start_slice, 0).? :0];
2549 return start_slice[0..mem.findScalar(u8, start_slice, 0).? :0];
25502550 }
25512551
25522552 pub fn toOptional(i: String) OptionalString {
......@@ -4332,7 +4332,7 @@ pub fn internOptionalString(wasm: *Wasm, optional_bytes: ?[]const u8) Allocator.
43324332}
43334333
43344334pub fn internString(wasm: *Wasm, bytes: []const u8) Allocator.Error!String {
4335 assert(mem.indexOfScalar(u8, bytes, 0) == null);
4335 assert(mem.findScalar(u8, bytes, 0) == null);
43364336 wasm.string_bytes_lock.lock();
43374337 defer wasm.string_bytes_lock.unlock();
43384338 const gpa = wasm.base.comp.gpa;
......@@ -4363,7 +4363,7 @@ pub fn internStringFmt(wasm: *Wasm, comptime format: []const u8, args: anytype)
43634363}
43644364
43654365pub fn getExistingString(wasm: *const Wasm, bytes: []const u8) ?String {
4366 assert(mem.indexOfScalar(u8, bytes, 0) == null);
4366 assert(mem.findScalar(u8, bytes, 0) == null);
43674367 return wasm.string_table.getKeyAdapted(bytes, @as(String.TableIndexAdapter, .{
43684368 .bytes = wasm.string_bytes.items,
43694369 }));
src/link/Wasm/Archive.zig+1-1
......@@ -45,7 +45,7 @@ const Header = extern struct {
4545
4646 fn nameOrIndex(archive: Header) !NameOrIndex {
4747 const value = getValue(&archive.name);
48 const slash_index = mem.indexOfScalar(u8, value, '/') orelse return error.MalformedArchive;
48 const slash_index = mem.findScalar(u8, value, '/') orelse return error.MalformedArchive;
4949 const len = value.len;
5050 if (slash_index == len - 1) {
5151 // Name stored directly
src/link/Wasm/Flush.zig+3-3
......@@ -1925,7 +1925,7 @@ fn emitProducerSection(gpa: Allocator, binary_bytes: *ArrayList(u8)) !void {
19251925
19261926fn splitSegmentName(name: []const u8) struct { []const u8, []const u8 } {
19271927 const start = @intFromBool(name.len >= 1 and name[0] == '.');
1928 const pivot = mem.indexOfScalarPos(u8, name, start, '.') orelse name.len;
1928 const pivot = mem.findScalarPos(u8, name, start, '.') orelse name.len;
19291929 return .{ name[0..pivot], name[pivot..] };
19301930}
19311931
......@@ -2092,7 +2092,7 @@ fn emitTagNameTable(
20922092 const ptr_size_bytes: usize = if (is64) 8 else 4;
20932093 try code.ensureUnusedCapacity(gpa, ptr_size_bytes * 2 * tag_name_offs.len);
20942094 for (tag_name_offs) |off| {
2095 const name_len: u32 = @intCast(mem.indexOfScalar(u8, tag_name_bytes[off..], 0).?);
2095 const name_len: u32 = @intCast(mem.findScalar(u8, tag_name_bytes[off..], 0).?);
20962096 if (is64) {
20972097 mem.writeInt(u64, code.addManyAsArrayAssumeCapacity(8), base + off, .little);
20982098 mem.writeInt(u64, code.addManyAsArrayAssumeCapacity(8), name_len, .little);
......@@ -2119,7 +2119,7 @@ fn emitRelocatableNameTable(
21192119 try code.ensureUnusedCapacity(gpa, @as(usize, ptr_size) * 2 * name_offs.len);
21202120 try relocs.ensureUnusedCapacity(gpa, name_offs.len);
21212121 for (name_offs) |off| {
2122 const name_len: u32 = @intCast(mem.indexOfScalar(u8, name_bytes[off..], 0).?);
2122 const name_len: u32 = @intCast(mem.findScalar(u8, name_bytes[off..], 0).?);
21232123 const reloc_offset = output_offset + @as(u32, @intCast(code.items.len - table_start));
21242124 switch (ptr_size) {
21252125 4 => {
src/main.zig+3-3
......@@ -2148,7 +2148,7 @@ fn buildOutputType(
21482148 preprocessor_arg[0] == '-' and
21492149 preprocessor_arg[2] != '-')
21502150 {
2151 if (mem.indexOfScalar(u8, preprocessor_arg, '=')) |equals_pos| {
2151 if (mem.findScalar(u8, preprocessor_arg, '=')) |equals_pos| {
21522152 const key = preprocessor_arg[0..equals_pos];
21532153 const value = preprocessor_arg[equals_pos + 1 ..];
21542154 try preprocessor_args.append(key);
......@@ -2170,7 +2170,7 @@ fn buildOutputType(
21702170 linker_arg[0] == '-' and
21712171 linker_arg[2] != '-')
21722172 {
2173 if (mem.indexOfScalar(u8, linker_arg, '=')) |equals_pos| {
2173 if (mem.findScalar(u8, linker_arg, '=')) |equals_pos| {
21742174 const key = linker_arg[0..equals_pos];
21752175 const value = linker_arg[equals_pos + 1 ..];
21762176
......@@ -2378,7 +2378,7 @@ fn buildOutputType(
23782378 // Handle joined args like `--dependency-file=foo.d`.
23792379 // Must be prefixed with 1 or 2 dashes.
23802380 if (it.only_arg.len >= 3 and it.only_arg[0] == '-' and it.only_arg[2] != '-') {
2381 if (mem.indexOfScalar(u8, it.only_arg, '=')) |equals_pos| {
2381 if (mem.findScalar(u8, it.only_arg, '=')) |equals_pos| {
23822382 const key = it.only_arg[0..equals_pos];
23832383 const value = it.only_arg[equals_pos + 1 ..];
23842384
src/target.zig+2-2
......@@ -680,14 +680,14 @@ pub fn isDynamicAMDGCNFeature(target: *const std.Target, feature: std.Target.Cpu
680680 const feature_tag: std.Target.amdgcn.Feature = @fromBackingInt(@intCast(feature.index));
681681
682682 if (feature_tag == .sramecc) {
683 if (std.mem.indexOfScalar(
683 if (std.mem.findScalar(
684684 *const std.Target.Cpu.Model,
685685 sramecc_only ++ xnack_or_sramecc,
686686 target.cpu.model,
687687 )) |_| return true;
688688 }
689689 if (feature_tag == .xnack) {
690 if (std.mem.indexOfScalar(
690 if (std.mem.findScalar(
691691 *const std.Target.Cpu.Model,
692692 xnack_or_sramecc,
693693 target.cpu.model,
test/src/Cases.zig+2-2
......@@ -491,7 +491,7 @@ pub fn lowerToBuildSteps(
491491
492492 for (self.cases.items) |case| {
493493 for (options.test_filters) |test_filter| {
494 if (std.mem.indexOf(u8, case.name, test_filter)) |_| break;
494 if (std.mem.find(u8, case.name, test_filter)) |_| break;
495495 } else if (options.test_filters.len > 0) continue;
496496
497497 if (case.case.? == .Error and options.skip_compile_errors) continue;
......@@ -524,7 +524,7 @@ pub fn lowerToBuildSteps(
524524
525525 if (options.test_target_filters.len > 0) {
526526 for (options.test_target_filters) |filter| {
527 if (std.mem.indexOf(u8, triple_txt, filter) != null) break;
527 if (std.mem.find(u8, triple_txt, filter) != null) break;
528528 } else continue;
529529 }
530530
test/src/Debugger.zig+2-2
......@@ -2384,13 +2384,13 @@ fn addTest(
23842384) void {
23852385 if (db.options.test_filters.len > 0) {
23862386 for (db.options.test_filters) |test_filter| {
2387 if (std.mem.indexOf(u8, name, test_filter) != null) break;
2387 if (std.mem.find(u8, name, test_filter) != null) break;
23882388 } else return;
23892389 }
23902390 if (db.options.test_target_filters.len > 0) {
23912391 const triple_txt = target.resolved.query.zigTriple(db.b.allocator) catch @panic("OOM");
23922392 for (db.options.test_target_filters) |filter| {
2393 if (std.mem.indexOf(u8, triple_txt, filter) != null) break;
2393 if (std.mem.find(u8, triple_txt, filter) != null) break;
23942394 } else return;
23952395 }
23962396 const files_wf = db.b.addWriteFiles();
test/src/ErrorTrace.zig+1-1
......@@ -82,7 +82,7 @@ fn addCaseConfig(
8282 });
8383 if (self.test_filters.len > 0) {
8484 for (self.test_filters) |test_filter| {
85 if (mem.indexOf(u8, annotated_case_name, test_filter)) |_| break;
85 if (mem.find(u8, annotated_case_name, test_filter)) |_| break;
8686 } else return;
8787 }
8888
test/src/Libc.zig+2-2
......@@ -49,7 +49,7 @@ pub fn addTarget(libc: *const Libc, target: std.Build.ResolvedTarget) void {
4949 if (libc.options.test_target_filters.len > 0) {
5050 const triple_txt = target.query.zigTriple(libc.b.allocator) catch @panic("OOM");
5151 for (libc.options.test_target_filters) |filter| {
52 if (std.mem.indexOf(u8, triple_txt, filter)) |_| break;
52 if (std.mem.find(u8, triple_txt, filter)) |_| break;
5353 } else return;
5454 }
5555
......@@ -82,7 +82,7 @@ pub fn addTarget(libc: *const Libc, target: std.Build.ResolvedTarget) void {
8282
8383 const annotated_case_name = libc.b.fmt("run libc-test {s} ({t})", .{ test_case.name, optimize });
8484 for (libc.options.test_filters) |test_filter| {
85 if (std.mem.indexOf(u8, annotated_case_name, test_filter)) |_| break;
85 if (std.mem.find(u8, annotated_case_name, test_filter)) |_| break;
8686 } else if (libc.options.test_filters.len > 0) continue;
8787
8888 const mod = libc.b.createModule(.{
test/src/Link.zig+1-1
......@@ -8,7 +8,7 @@ use_lld: bool,
88link_libc: bool,
99test_filters: []const []const u8,
1010update_step: ?*Step.UpdateSourceFiles,
11updated_snapshots: std.StringArrayHashMapUnmanaged(void),
11updated_snapshots: std.array_hash_map.String(void),
1212max_rss: usize,
1313
1414pub fn includeTest(self: *Link, prefix: []const u8) ?Case {
test/src/LlvmIr.zig+2-2
......@@ -77,14 +77,14 @@ pub fn addCase(self: *LlvmIr, case: TestCase) void {
7777 if (self.options.test_target_filters.len > 0) {
7878 const triple_txt = target.query.zigTriple(self.b.allocator) catch @panic("OOM");
7979 for (self.options.test_target_filters) |filter| {
80 if (std.mem.indexOf(u8, triple_txt, filter) != null) break;
80 if (std.mem.find(u8, triple_txt, filter) != null) break;
8181 } else return;
8282 }
8383
8484 const name = std.fmt.allocPrint(self.b.allocator, "check llvm-ir {s}", .{case.name}) catch @panic("OOM");
8585 if (self.options.test_filters.len > 0) {
8686 for (self.options.test_filters) |filter| {
87 if (std.mem.indexOf(u8, name, filter) != null) break;
87 if (std.mem.find(u8, name, filter) != null) break;
8888 } else return;
8989 }
9090
test/src/RunTranslatedC.zig+1-1
......@@ -68,7 +68,7 @@ pub fn addCase(self: *RunTranslatedCContext, case: *const TestCase) void {
6868
6969 const annotated_case_name = fmt.allocPrint(self.b.allocator, "run-translated-c {s}", .{case.name}) catch unreachable;
7070 for (self.test_filters) |test_filter| {
71 if (mem.indexOf(u8, annotated_case_name, test_filter)) |_| break;
71 if (mem.find(u8, annotated_case_name, test_filter)) |_| break;
7272 } else if (self.test_filters.len > 0) return;
7373
7474 const write_src = b.addWriteFiles();
test/src/StackTrace.zig+1-1
......@@ -200,7 +200,7 @@ fn addCaseInstance(
200200 });
201201 if (self.test_filters.len > 0) {
202202 for (self.test_filters) |test_filter| {
203 if (mem.indexOf(u8, annotated_case_name, test_filter)) |_| break;
203 if (mem.find(u8, annotated_case_name, test_filter)) |_| break;
204204 } else return;
205205 }
206206
test/src/TranslateC.zig+2-2
......@@ -90,7 +90,7 @@ pub fn addCase(self: *TranslateCContext, case: *const TestCase) void {
9090 const translate_c_cmd = "translate-c";
9191 const annotated_case_name = fmt.allocPrint(self.b.allocator, "{s} {s}", .{ translate_c_cmd, case.name }) catch unreachable;
9292 for (self.test_filters) |test_filter| {
93 if (mem.indexOf(u8, annotated_case_name, test_filter)) |_| break;
93 if (mem.find(u8, annotated_case_name, test_filter)) |_| break;
9494 } else if (self.test_filters.len > 0) return;
9595
9696 const target = b.resolveTargetQuery(case.target);
......@@ -99,7 +99,7 @@ pub fn addCase(self: *TranslateCContext, case: *const TestCase) void {
9999 const triple_txt = target.query.zigTriple(b.allocator) catch @panic("OOM");
100100
101101 for (self.test_target_filters) |filter| {
102 if (std.mem.indexOf(u8, triple_txt, filter) != null) break;
102 if (std.mem.find(u8, triple_txt, filter) != null) break;
103103 } else return;
104104 }
105105
test/src/convert-stack-trace.zig+3-3
......@@ -52,13 +52,13 @@ pub fn main(init: std.process.Init) !void {
5252 continue;
5353 }
5454
55 const src_pos_end = std.mem.indexOf(u8, in_line, ": 0x") orelse {
55 const src_pos_end = std.mem.find(u8, in_line, ": 0x") orelse {
5656 try w.writeAll(in_line);
5757 continue;
5858 };
5959 const src_pos_start = b: {
6060 const postfix = ".zig:";
61 const postfix_index = std.mem.lastIndexOf(u8, in_line[0..src_pos_end], postfix) orelse {
61 const postfix_index = std.mem.findLast(u8, in_line[0..src_pos_end], postfix) orelse {
6262 try w.writeAll(in_line);
6363 continue;
6464 };
......@@ -89,7 +89,7 @@ pub fn main(init: std.process.Init) !void {
8989 // ...with that first '_' being replaced by its basename.
9090
9191 const src_path = in_line[0..src_pos_start];
92 const basename_start = if (std.mem.lastIndexOfAny(u8, src_path, "/\\")) |i| i + 1 else 0;
92 const basename_start = if (std.mem.findLastAny(u8, src_path, "/\\")) |i| i + 1 else 0;
9393 const symbol_start = addr_end + " in ".len;
9494 try w.writeAll(in_line[basename_start..src_pos_end]);
9595 try w.writeAll(": [address] in ");
test/tests.zig+9-9
......@@ -2542,13 +2542,13 @@ pub fn addStandaloneTests(
25422542 .enable_ios_sdk = enable_ios_sdk,
25432543 .enable_macos_sdk = enable_macos_sdk,
25442544 .enable_symlinks_windows = enable_symlinks_windows,
2545 .simple_skip_debug = mem.indexOfScalar(OptimizeMode, optimize_modes, .debug) == null,
2546 .simple_skip_release_safe = mem.indexOfScalar(OptimizeMode, optimize_modes, .safe) == null,
2547 .simple_skip_release_fast = mem.indexOfScalar(OptimizeMode, optimize_modes, .fast) == null,
2548 .simple_skip_release_small = mem.indexOfScalar(OptimizeMode, optimize_modes, .small) == null,
2545 .simple_skip_debug = mem.findScalar(OptimizeMode, optimize_modes, .debug) == null,
2546 .simple_skip_release_safe = mem.findScalar(OptimizeMode, optimize_modes, .safe) == null,
2547 .simple_skip_release_fast = mem.findScalar(OptimizeMode, optimize_modes, .fast) == null,
2548 .simple_skip_release_small = mem.findScalar(OptimizeMode, optimize_modes, .small) == null,
25492549 });
25502550 const test_cases_dep_step = test_cases_dep.builder.default_step;
2551 test_cases_dep_step.name = b.dupe(test_cases_dep_name);
2551 test_cases_dep_step.name = b.graph.dupeString(test_cases_dep_name);
25522552 step.dependOn(test_cases_dep.builder.default_step);
25532553 }
25542554 return step;
......@@ -2862,7 +2862,7 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step {
28622862
28632863 if (options.test_target_filters.len > 0) {
28642864 for (options.test_target_filters) |filter| {
2865 if (std.mem.indexOf(u8, triple_txt, filter) != null) break;
2865 if (std.mem.find(u8, triple_txt, filter) != null) break;
28662866 } else continue;
28672867 }
28682868
......@@ -3160,7 +3160,7 @@ pub fn addCAbiTests(b: *std.Build, options: CAbiTestOptions) *Step {
31603160
31613161 if (options.test_target_filters.len > 0) {
31623162 for (options.test_target_filters) |filter| {
3163 if (std.mem.indexOf(u8, triple_txt, filter) != null) break;
3163 if (std.mem.find(u8, triple_txt, filter) != null) break;
31643164 } else continue;
31653165 }
31663166
......@@ -3249,7 +3249,7 @@ pub fn addLinkTests(b: *std.Build, options: LinkTestOptions) *Step {
32493249
32503250 if (options.test_target_filters.len > 0) {
32513251 for (options.test_target_filters) |filter| {
3252 if (std.mem.indexOf(u8, triple_txt, filter) != null) break;
3252 if (std.mem.find(u8, triple_txt, filter) != null) break;
32533253 } else continue;
32543254 }
32553255
......@@ -3374,7 +3374,7 @@ pub fn addIncrementalTests(b: *std.Build, test_step: *Step, test_filters: []cons
33743374 if (std.mem.endsWith(u8, entry.basename, ".swp")) continue;
33753375
33763376 for (test_filters) |test_filter| {
3377 if (std.mem.indexOf(u8, entry.path, test_filter)) |_| break;
3377 if (std.mem.find(u8, entry.path, test_filter)) |_| break;
33783378 } else if (test_filters.len > 0) continue;
33793379
33803380 switch (entry.kind) {
tools/docgen.zig+2-2
......@@ -712,10 +712,10 @@ fn tokenizeAndPrintRaw(
712712 next_tok_is_fn = false;
713713
714714 const token = tokenizer.next();
715 if (mem.indexOf(u8, src[index..token.loc.start], "//")) |comment_start_off| {
715 if (mem.find(u8, src[index..token.loc.start], "//")) |comment_start_off| {
716716 // render one comment
717717 const comment_start = index + comment_start_off;
718 const comment_end_off = mem.indexOf(u8, src[comment_start..token.loc.start], "\n");
718 const comment_end_off = mem.find(u8, src[comment_start..token.loc.start], "\n");
719719 const comment_end = if (comment_end_off) |o| comment_start + o else token.loc.start;
720720
721721 try writeEscapedLines(out, src[index..comment_start]);
tools/doctest.zig+8-8
......@@ -383,7 +383,7 @@ fn printOutput(
383383 fatal("example compile crashed", .{});
384384 },
385385 }
386 if (mem.indexOf(u8, result.stderr, error_match) == null) {
386 if (mem.find(u8, result.stderr, error_match) == null) {
387387 print("{s}\nExpected to find '{s}' in stderr\n", .{ result.stderr, error_match });
388388 fatal("example did not have expected compile error", .{});
389389 }
......@@ -438,7 +438,7 @@ fn printOutput(
438438 fatal("example compile crashed", .{});
439439 },
440440 }
441 if (mem.indexOf(u8, result.stderr, error_match) == null) {
441 if (mem.find(u8, result.stderr, error_match) == null) {
442442 print("{s}\nExpected to find '{s}' in stderr\n", .{ result.stderr, error_match });
443443 fatal("example did not have expected runtime safety error message", .{});
444444 }
......@@ -513,7 +513,7 @@ fn printOutput(
513513 fatal("example compile crashed", .{});
514514 },
515515 }
516 if (mem.indexOf(u8, result.stderr, error_match) == null) {
516 if (mem.find(u8, result.stderr, error_match) == null) {
517517 print("{s}\nExpected to find '{s}' in stderr\n", .{ result.stderr, error_match });
518518 fatal("example did not have expected compile error message", .{});
519519 }
......@@ -623,10 +623,10 @@ fn tokenizeAndPrint(arena: Allocator, out: *Writer, raw_src: []const u8) !void {
623623 next_tok_is_fn = false;
624624
625625 const token = tokenizer.next();
626 if (mem.indexOf(u8, src[index..token.loc.start], "//")) |comment_start_off| {
626 if (mem.find(u8, src[index..token.loc.start], "//")) |comment_start_off| {
627627 // render one comment
628628 const comment_start = index + comment_start_off;
629 const comment_end_off = mem.indexOf(u8, src[comment_start..token.loc.start], "\n");
629 const comment_end_off = mem.find(u8, src[comment_start..token.loc.start], "\n");
630630 const comment_end = if (comment_end_off) |o| comment_start + o else token.loc.start;
631631
632632 try writeEscapedLines(out, src[index..comment_start]);
......@@ -870,13 +870,13 @@ const Code = struct {
870870};
871871
872872fn stripManifest(source_bytes: []const u8) []const u8 {
873 const manifest_start = mem.lastIndexOf(u8, source_bytes, "\n\n// ") orelse
873 const manifest_start = mem.findLast(u8, source_bytes, "\n\n// ") orelse
874874 fatal("missing manifest comment", .{});
875875 return source_bytes[0 .. manifest_start + 1];
876876}
877877
878878fn parseManifest(arena: Allocator, source_bytes: []const u8) !Code {
879 const manifest_start = mem.lastIndexOf(u8, source_bytes, "\n\n// ") orelse
879 const manifest_start = mem.findLast(u8, source_bytes, "\n\n// ") orelse
880880 fatal("missing manifest comment", .{});
881881 var it = mem.tokenizeScalar(u8, source_bytes[manifest_start..], '\n');
882882 const first_line = skipPrefix(it.next().?);
......@@ -1104,7 +1104,7 @@ fn termColor(allocator: Allocator, input: []const u8) ![]u8 {
11041104
11051105// Returns true if number is in slice.
11061106fn in(slice: []const u8, number: u8) bool {
1107 return mem.indexOfScalar(u8, slice, number) != null;
1107 return mem.findScalar(u8, slice, number) != null;
11081108}
11091109
11101110fn run(
tools/fetch_them_macos_headers.zig+2-2
......@@ -187,8 +187,8 @@ fn fetchTarget(
187187
188188 var it = mem.splitScalar(u8, headers_list_str, '\n');
189189 while (it.next()) |line| {
190 if (mem.lastIndexOf(u8, line, "clang") != null) continue;
191 if (mem.lastIndexOf(u8, line, prefix[0..])) |idx| {
190 if (mem.findLast(u8, line, "clang") != null) continue;
191 if (mem.findLast(u8, line, prefix[0..])) |idx| {
192192 const out_rel_path = line[idx + prefix.len + 1 ..];
193193 const out_rel_path_stripped = mem.trim(u8, out_rel_path, " \\");
194194 const dirname = Dir.path.dirname(out_rel_path_stripped) orelse ".";
tools/incr-check.zig+3-3
......@@ -450,7 +450,7 @@ const Eval = struct {
450450 const raw_filename = eb.nullTerminatedString(src.src_path);
451451 // We need to replace backslashes for consistency between platforms.
452452 const filename = name: {
453 if (std.mem.indexOfScalar(u8, raw_filename, '\\') == null) break :name raw_filename;
453 if (std.mem.findScalar(u8, raw_filename, '\\') == null) break :name raw_filename;
454454 const copied = try eval.arena.dupe(u8, raw_filename);
455455 std.mem.replaceScalar(u8, copied, '\\', '/');
456456 break :name copied;
......@@ -777,7 +777,7 @@ const Case = struct {
777777 .backend = backend,
778778 });
779779 } else if (std.mem.eql(u8, key, "module")) {
780 const split_idx = std.mem.indexOfScalar(u8, val, '=') orelse
780 const split_idx = std.mem.findScalar(u8, val, '=') orelse
781781 fatal("line {d}: module does not include file", .{line_n});
782782 const name = val[0..split_idx];
783783 const file = val[split_idx + 1 ..];
......@@ -983,7 +983,7 @@ fn rand64(io: Io) u64 {
983983fn parseTargetQueryAndBackend(input_str: []const u8, err_prefix: []const u8) struct { std.Target.Query, Backend } {
984984 const fatal = std.process.fatal;
985985
986 const split_idx = std.mem.lastIndexOfScalar(u8, input_str, '-') orelse
986 const split_idx = std.mem.findScalarLast(u8, input_str, '-') orelse
987987 fatal("{s}target does not include backend", .{err_prefix});
988988
989989 const query = input_str[0..split_idx];
tools/update_clang_options.zig+1-1
......@@ -599,7 +599,7 @@ const known_options = [_]KnownOpt{
599599const blacklisted_options = [_][]const u8{};
600600
601601fn knownOption(name: []const u8) ?[]const u8 {
602 const chopped_name = if (std.mem.indexOfScalar(u8, name, '=')) |idx| name[0..idx] else name;
602 const chopped_name = if (std.mem.findScalar(u8, name, '=')) |idx| name[0..idx] else name;
603603 for (known_options) |item| {
604604 if (std.mem.eql(u8, chopped_name, item.name)) {
605605 return item.ident;
tools/update_crc_catalog.zig+1-1
......@@ -99,7 +99,7 @@ fn @"i like cheese"(arena: std.mem.Allocator, io: Io, args: []const []const u8)
9999
100100 var it = mem.splitSequence(u8, line, " ");
101101 while (it.next()) |property| {
102 const i = mem.indexOf(u8, property, "=").?;
102 const i = mem.find(u8, property, "=").?;
103103 const key = property[0..i];
104104 const value = property[i + 1 ..];
105105 if (mem.eql(u8, key, "width")) {