authorgravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2024-05-02 20:20:41-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-06-13 10:18:59-04:00
log76fb2b685b202ea665b850338e353c7816f5b2bb
tree16b4b39db7541febd2b4bf92c041239bdd45f144
parent4aa15440c7a12bcc6bc0cd589ade02295549d48c

std: Convert deprecated aliases to compile errors and fix usages

Deprecated aliases that are now compile errors: - `std.fs.MAX_PATH_BYTES` (renamed to `std.fs.max_path_bytes`) - `std.mem.tokenize` (split into `tokenizeAny`, `tokenizeSequence`, `tokenizeScalar`) - `std.mem.split` (split into `splitSequence`, `splitAny`, `splitScalar`) - `std.mem.splitBackwards` (split into `splitBackwardsSequence`, `splitBackwardsAny`, `splitBackwardsScalar`) - `std.unicode` + `utf16leToUtf8Alloc`, `utf16leToUtf8AllocZ`, `utf16leToUtf8`, `fmtUtf16le` (all renamed to have capitalized `Le`) + `utf8ToUtf16LeWithNull` (renamed to `utf8ToUtf16LeAllocZ`) - `std.zig.CrossTarget` (moved to `std.Target.Query`) Deprecated `lib/std/std.zig` decls were deleted instead of made a `@compileError` because the `refAllDecls` in the test block would trigger the `@compileError`. The deleted top-level `std` namespaces are: - `std.rand` (renamed to `std.Random`) - `std.TailQueue` (renamed to `std.DoublyLinkedList`) - `std.ChildProcess` (renamed/moved to `std.process.Child`) This is not exhaustive. Deprecated aliases that I didn't touch: + `std.io.*` + `std.Build.*` + `std.builtin.Mode` + `std.zig.c_translation.CIntLiteralRadix` + anything in `src/`

47 files changed, 136 insertions(+), 150 deletions(-)

build.zig+2-2
......@@ -15,7 +15,7 @@ const stack_size = 32 * 1024 * 1024;
1515pub fn build(b: *std.Build) !void {
1616 const only_c = b.option(bool, "only-c", "Translate the Zig compiler to C code, with only the C backend enabled") orelse false;
1717 const target = t: {
18 var default_target: std.zig.CrossTarget = .{};
18 var default_target: std.Target.Query = .{};
1919 default_target.ofmt = b.option(std.Target.ObjectFormat, "ofmt", "Object format to target") orelse if (only_c) .c else null;
2020 break :t b.standardTargetOptions(.{ .default_target = default_target });
2121 };
......@@ -559,7 +559,7 @@ pub fn build(b: *std.Build) !void {
559559fn addWasiUpdateStep(b: *std.Build, version: [:0]const u8) !void {
560560 const semver = try std.SemanticVersion.parse(version);
561561
562 var target_query: std.zig.CrossTarget = .{
562 var target_query: std.Target.Query = .{
563563 .cpu_arch = .wasm32,
564564 .os_tag = .wasi,
565565 };
lib/compiler/aro/aro/Driver.zig+1-1
......@@ -792,7 +792,7 @@ pub fn invokeLinker(d: *Driver, tc: *Toolchain, comptime fast_exit: bool) !void
792792 var argv = std.ArrayList([]const u8).init(d.comp.gpa);
793793 defer argv.deinit();
794794
795 var linker_path_buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
795 var linker_path_buf: [std.fs.max_path_bytes]u8 = undefined;
796796 const linker_path = try tc.getLinkerPath(&linker_path_buf);
797797 try argv.append(linker_path);
798798
lib/compiler/aro/aro/Driver/Filesystem.zig+2-2
......@@ -46,7 +46,7 @@ fn canExecuteFake(entries: []const Filesystem.Entry, path: []const u8) bool {
4646
4747fn existsFake(entries: []const Filesystem.Entry, path: []const u8) bool {
4848 @setCold(true);
49 var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
49 var buf: [std.fs.max_path_bytes]u8 = undefined;
5050 var fib = std.heap.FixedBufferAllocator.init(&buf);
5151 const resolved = std.fs.path.resolvePosix(fib.allocator(), &.{path}) catch return false;
5252 for (entries) |entry| {
......@@ -181,7 +181,7 @@ pub const Filesystem = union(enum) {
181181 }
182182
183183 pub fn joinedExists(fs: Filesystem, parts: []const []const u8) bool {
184 var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
184 var buf: [std.fs.max_path_bytes]u8 = undefined;
185185 var fib = std.heap.FixedBufferAllocator.init(&buf);
186186 const joined = std.fs.path.join(fib.allocator(), parts) catch return false;
187187 return fs.exists(joined);
lib/compiler/aro/aro/Driver/GCCDetector.zig+2-2
......@@ -397,7 +397,7 @@ fn collectLibDirsAndTriples(
397397}
398398
399399pub fn discover(self: *GCCDetector, tc: *Toolchain) !void {
400 var path_buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
400 var path_buf: [std.fs.max_path_bytes]u8 = undefined;
401401 var fib = std.heap.FixedBufferAllocator.init(&path_buf);
402402
403403 const target = tc.getTarget();
......@@ -589,7 +589,7 @@ fn scanLibDirForGCCTriple(
589589 gcc_dir_exists: bool,
590590 gcc_cross_dir_exists: bool,
591591) !void {
592 var path_buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
592 var path_buf: [std.fs.max_path_bytes]u8 = undefined;
593593 var fib = std.heap.FixedBufferAllocator.init(&path_buf);
594594 for (0..2) |i| {
595595 if (i == 0 and !gcc_dir_exists) continue;
lib/compiler/aro/aro/Toolchain.zig+3-3
......@@ -221,7 +221,7 @@ pub fn addFilePathLibArgs(tc: *const Toolchain, argv: *std.ArrayList([]const u8)
221221/// If not found there, just use `name`
222222/// Writes the result to `buf` and returns a slice of it
223223fn getProgramPath(tc: *const Toolchain, name: []const u8, buf: []u8) []const u8 {
224 var path_buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
224 var path_buf: [std.fs.max_path_bytes]u8 = undefined;
225225 var fib = std.heap.FixedBufferAllocator.init(&path_buf);
226226
227227 var tool_specific_buf: [64]u8 = undefined;
......@@ -251,7 +251,7 @@ pub fn getSysroot(tc: *const Toolchain) []const u8 {
251251/// Search for `name` in a variety of places
252252/// TODO: cache results based on `name` so we're not repeatedly allocating the same strings?
253253pub fn getFilePath(tc: *const Toolchain, name: []const u8) ![]const u8 {
254 var path_buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
254 var path_buf: [std.fs.max_path_bytes]u8 = undefined;
255255 var fib = std.heap.FixedBufferAllocator.init(&path_buf);
256256 const allocator = fib.allocator();
257257
......@@ -304,7 +304,7 @@ const PathKind = enum {
304304/// Join `components` into a path. If the path exists, dupe it into the toolchain arena and
305305/// add it to the specified path list.
306306pub fn addPathIfExists(tc: *Toolchain, components: []const []const u8, dest_kind: PathKind) !void {
307 var path_buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
307 var path_buf: [std.fs.max_path_bytes]u8 = undefined;
308308 var fib = std.heap.FixedBufferAllocator.init(&path_buf);
309309
310310 const candidate = try std.fs.path.join(fib.allocator(), components);
lib/compiler/aro/aro/Value.zig+1-1
......@@ -706,7 +706,7 @@ pub fn printString(bytes: []const u8, ty: Type, comp: *const Compilation, w: any
706706 switch (size) {
707707 inline .@"1", .@"2" => |sz| {
708708 const data_slice: []const sz.Type() = @alignCast(std.mem.bytesAsSlice(sz.Type(), without_null));
709 const formatter = if (sz == .@"1") std.zig.fmtEscapes(data_slice) else std.unicode.fmtUtf16le(data_slice);
709 const formatter = if (sz == .@"1") std.zig.fmtEscapes(data_slice) else std.unicode.fmtUtf16Le(data_slice);
710710 try w.print("\"{}\"", .{formatter});
711711 },
712712 .@"4" => {
lib/compiler/aro/aro/toolchains/Linux.zig+1-1
......@@ -478,7 +478,7 @@ test Linux {
478478 var argv = std.ArrayList([]const u8).init(driver.comp.gpa);
479479 defer argv.deinit();
480480
481 var linker_path_buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
481 var linker_path_buf: [std.fs.max_path_bytes]u8 = undefined;
482482 const linker_path = try toolchain.getLinkerPath(&linker_path_buf);
483483 try argv.append(linker_path);
484484
lib/compiler/resinator/cli.zig+1-1
......@@ -846,7 +846,7 @@ pub fn parse(allocator: Allocator, args: []const []const u8, diagnostics: *Diagn
846846 arg_i += 1;
847847 break :next_arg;
848848 };
849 var tokenizer = std.mem.tokenize(u8, value.slice, "=");
849 var tokenizer = std.mem.tokenizeScalar(u8, value.slice, '=');
850850 // guaranteed to exist since an empty value.slice would invoke
851851 // the 'missing symbol to define' branch above
852852 const symbol = tokenizer.next().?;
lib/compiler/resinator/compile.zig+1-1
......@@ -3405,7 +3405,7 @@ test "StringTable" {
34053405 }
34063406 break :ids buf;
34073407 };
3408 var prng = std.rand.DefaultPrng.init(0);
3408 var prng = std.Random.DefaultPrng.init(0);
34093409 var random = prng.random();
34103410 random.shuffle(u16, &ids);
34113411
lib/compiler/resinator/source_mapping.zig+1-1
......@@ -214,7 +214,7 @@ pub fn handleLineEnd(allocator: Allocator, post_processed_line_number: usize, ma
214214// TODO: Might want to provide diagnostics on invalid line commands instead of just returning
215215pub fn handleLineCommand(allocator: Allocator, line_command: []const u8, current_mapping: *CurrentMapping) error{OutOfMemory}!void {
216216 // TODO: Are there other whitespace characters that should be included?
217 var tokenizer = std.mem.tokenize(u8, line_command, " \t");
217 var tokenizer = std.mem.tokenizeAny(u8, line_command, " \t");
218218 const line_directive = tokenizer.next() orelse return; // #line
219219 if (!std.mem.eql(u8, line_directive, "#line")) return;
220220 const linenum_str = tokenizer.next() orelse return;
lib/docs/wasm/main.zig+1-1
......@@ -1212,7 +1212,7 @@ fn unindent(s: []const u8, indent: usize) []const u8 {
12121212}
12131213
12141214fn appendUnindented(out: *std.ArrayListUnmanaged(u8), s: []const u8, indent: usize) !void {
1215 var it = std.mem.split(u8, s, "\n");
1215 var it = std.mem.splitScalar(u8, s, '\n');
12161216 var is_first_line = true;
12171217 while (it.next()) |line| {
12181218 if (is_first_line) {
lib/docs/wasm/markdown.zig+1-1
......@@ -1112,7 +1112,7 @@ fn testRender(input: []const u8, expected: []const u8) !void {
11121112 var parser = try Parser.init(testing.allocator);
11131113 defer parser.deinit();
11141114
1115 var lines = std.mem.split(u8, input, "\n");
1115 var lines = std.mem.splitScalar(u8, input, '\n');
11161116 while (lines.next()) |line| {
11171117 try parser.feedLine(line);
11181118 }
lib/std/Build/Cache/Path.zig+6-6
......@@ -49,7 +49,7 @@ pub fn openFile(
4949 sub_path: []const u8,
5050 flags: fs.File.OpenFlags,
5151) !fs.File {
52 var buf: [fs.MAX_PATH_BYTES]u8 = undefined;
52 var buf: [fs.max_path_bytes]u8 = undefined;
5353 const joined_path = if (p.sub_path.len == 0) sub_path else p: {
5454 break :p std.fmt.bufPrint(&buf, "{s}" ++ fs.path.sep_str ++ "{s}", .{
5555 p.sub_path, sub_path,
......@@ -59,7 +59,7 @@ pub fn openFile(
5959}
6060
6161pub fn makeOpenPath(p: Path, sub_path: []const u8, opts: fs.OpenDirOptions) !fs.Dir {
62 var buf: [fs.MAX_PATH_BYTES]u8 = undefined;
62 var buf: [fs.max_path_bytes]u8 = undefined;
6363 const joined_path = if (p.sub_path.len == 0) sub_path else p: {
6464 break :p std.fmt.bufPrint(&buf, "{s}" ++ fs.path.sep_str ++ "{s}", .{
6565 p.sub_path, sub_path,
......@@ -69,7 +69,7 @@ pub fn makeOpenPath(p: Path, sub_path: []const u8, opts: fs.OpenDirOptions) !fs.
6969}
7070
7171pub fn statFile(p: Path, sub_path: []const u8) !fs.Dir.Stat {
72 var buf: [fs.MAX_PATH_BYTES]u8 = undefined;
72 var buf: [fs.max_path_bytes]u8 = undefined;
7373 const joined_path = if (p.sub_path.len == 0) sub_path else p: {
7474 break :p std.fmt.bufPrint(&buf, "{s}" ++ fs.path.sep_str ++ "{s}", .{
7575 p.sub_path, sub_path,
......@@ -82,7 +82,7 @@ pub fn atomicFile(
8282 p: Path,
8383 sub_path: []const u8,
8484 options: fs.Dir.AtomicFileOptions,
85 buf: *[fs.MAX_PATH_BYTES]u8,
85 buf: *[fs.max_path_bytes]u8,
8686) !fs.AtomicFile {
8787 const joined_path = if (p.sub_path.len == 0) sub_path else p: {
8888 break :p std.fmt.bufPrint(buf, "{s}" ++ fs.path.sep_str ++ "{s}", .{
......@@ -93,7 +93,7 @@ pub fn atomicFile(
9393}
9494
9595pub fn access(p: Path, sub_path: []const u8, flags: fs.File.OpenFlags) !void {
96 var buf: [fs.MAX_PATH_BYTES]u8 = undefined;
96 var buf: [fs.max_path_bytes]u8 = undefined;
9797 const joined_path = if (p.sub_path.len == 0) sub_path else p: {
9898 break :p std.fmt.bufPrint(&buf, "{s}" ++ fs.path.sep_str ++ "{s}", .{
9999 p.sub_path, sub_path,
......@@ -103,7 +103,7 @@ pub fn access(p: Path, sub_path: []const u8, flags: fs.File.OpenFlags) !void {
103103}
104104
105105pub fn makePath(p: Path, sub_path: []const u8) !void {
106 var buf: [fs.MAX_PATH_BYTES]u8 = undefined;
106 var buf: [fs.max_path_bytes]u8 = undefined;
107107 const joined_path = if (p.sub_path.len == 0) sub_path else p: {
108108 break :p std.fmt.bufPrint(&buf, "{s}" ++ fs.path.sep_str ++ "{s}", .{
109109 p.sub_path, sub_path,
lib/std/Random.zig+1-1
......@@ -9,7 +9,7 @@ const math = std.math;
99const mem = std.mem;
1010const assert = std.debug.assert;
1111const maxInt = std.math.maxInt;
12pub const Random = @This(); // Remove pub when `std.rand` namespace is removed.
12const Random = @This();
1313
1414/// Fast unbiased random numbers.
1515pub const DefaultPrng = Xoshiro256;
lib/std/debug.zig+1-1
......@@ -1298,7 +1298,7 @@ pub fn readElfDebugInfo(
12981298 if (readElfDebugInfo(allocator, path, null, separate_debug_crc, &sections, mapped_mem)) |debug_info| return debug_info else |_| {}
12991299 }
13001300
1301 var cwd_buf: [fs.MAX_PATH_BYTES]u8 = undefined;
1301 var cwd_buf: [fs.max_path_bytes]u8 = undefined;
13021302 const cwd_path = posix.realpath(".", &cwd_buf) catch break :blk;
13031303
13041304 // <global debug directory>/<absolute folder of current binary>/<gnu_debuglink>
lib/std/fs.zig+18-19
......@@ -35,8 +35,7 @@ pub const realpathW = posix.realpathW;
3535pub const getAppDataDir = @import("fs/get_app_data_dir.zig").getAppDataDir;
3636pub const GetAppDataDirError = @import("fs/get_app_data_dir.zig").GetAppDataDirError;
3737
38/// Deprecated: use `max_path_bytes`.
39pub const MAX_PATH_BYTES = max_path_bytes;
38pub const MAX_PATH_BYTES = @compileError("deprecated; renamed to max_path_bytes");
4039
4140/// The maximum length of a file path that the operating system will accept.
4241///
......@@ -417,20 +416,20 @@ pub fn deleteTreeAbsolute(absolute_path: []const u8) !void {
417416/// On Windows, `pathname` should be encoded as [WTF-8](https://simonsapin.github.io/wtf-8/).
418417/// On WASI, `pathname` should be encoded as valid UTF-8.
419418/// On other platforms, `pathname` is an opaque sequence of bytes with no particular encoding.
420pub fn readLinkAbsolute(pathname: []const u8, buffer: *[MAX_PATH_BYTES]u8) ![]u8 {
419pub fn readLinkAbsolute(pathname: []const u8, buffer: *[max_path_bytes]u8) ![]u8 {
421420 assert(path.isAbsolute(pathname));
422421 return posix.readlink(pathname, buffer);
423422}
424423
425424/// Windows-only. Same as `readlinkW`, except the path parameter is null-terminated, WTF16
426425/// encoded.
427pub fn readlinkAbsoluteW(pathname_w: [*:0]const u16, buffer: *[MAX_PATH_BYTES]u8) ![]u8 {
426pub fn readlinkAbsoluteW(pathname_w: [*:0]const u16, buffer: *[max_path_bytes]u8) ![]u8 {
428427 assert(path.isAbsoluteWindowsW(pathname_w));
429428 return posix.readlinkW(pathname_w, buffer);
430429}
431430
432431/// Same as `readLink`, except the path parameter is null-terminated.
433pub fn readLinkAbsoluteZ(pathname_c: [*:0]const u8, buffer: *[MAX_PATH_BYTES]u8) ![]u8 {
432pub fn readLinkAbsoluteZ(pathname_c: [*:0]const u8, buffer: *[max_path_bytes]u8) ![]u8 {
434433 assert(path.isAbsoluteZ(pathname_c));
435434 return posix.readlinkZ(pathname_c, buffer);
436435}
......@@ -504,9 +503,9 @@ pub fn openSelfExe(flags: File.OpenFlags) OpenSelfExeError!File {
504503 const prefixed_path_w = try windows.wToPrefixedFileW(null, image_path_name);
505504 return cwd().openFileW(prefixed_path_w.span(), flags);
506505 }
507 // Use of MAX_PATH_BYTES here is valid as the resulting path is immediately
506 // Use of max_path_bytes here is valid as the resulting path is immediately
508507 // opened with no modification.
509 var buf: [MAX_PATH_BYTES]u8 = undefined;
508 var buf: [max_path_bytes]u8 = undefined;
510509 const self_exe_path = try selfExePath(&buf);
511510 buf[self_exe_path.len] = 0;
512511 return openFileAbsoluteZ(buf[0..self_exe_path.len :0].ptr, flags);
......@@ -554,14 +553,14 @@ pub const SelfExePathError = error{
554553/// `selfExePath` except allocates the result on the heap.
555554/// Caller owns returned memory.
556555pub fn selfExePathAlloc(allocator: Allocator) ![]u8 {
557 // Use of MAX_PATH_BYTES here is justified as, at least on one tested Linux
556 // Use of max_path_bytes here is justified as, at least on one tested Linux
558557 // system, readlink will completely fail to return a result larger than
559558 // PATH_MAX even if given a sufficiently large buffer. This makes it
560559 // fundamentally impossible to get the selfExePath of a program running in
561560 // a very deeply nested directory chain in this way.
562561 // TODO(#4812): Investigate other systems and whether it is possible to get
563562 // this path by trying larger and larger buffers until one succeeds.
564 var buf: [MAX_PATH_BYTES]u8 = undefined;
563 var buf: [max_path_bytes]u8 = undefined;
565564 return allocator.dupe(u8, try selfExePath(&buf));
566565}
567566
......@@ -581,12 +580,12 @@ pub fn selfExePath(out_buffer: []u8) SelfExePathError![]u8 {
581580 if (is_darwin) {
582581 // Note that _NSGetExecutablePath() will return "a path" to
583582 // the executable not a "real path" to the executable.
584 var symlink_path_buf: [MAX_PATH_BYTES:0]u8 = undefined;
585 var u32_len: u32 = MAX_PATH_BYTES + 1; // include the sentinel
583 var symlink_path_buf: [max_path_bytes:0]u8 = undefined;
584 var u32_len: u32 = max_path_bytes + 1; // include the sentinel
586585 const rc = std.c._NSGetExecutablePath(&symlink_path_buf, &u32_len);
587586 if (rc != 0) return error.NameTooLong;
588587
589 var real_path_buf: [MAX_PATH_BYTES]u8 = undefined;
588 var real_path_buf: [max_path_bytes]u8 = undefined;
590589 const real_path = std.posix.realpathZ(&symlink_path_buf, &real_path_buf) catch |err| switch (err) {
591590 error.InvalidWtf8 => unreachable, // Windows-only
592591 error.NetworkNotFound => unreachable, // Windows-only
......@@ -634,7 +633,7 @@ pub fn selfExePath(out_buffer: []u8) SelfExePathError![]u8 {
634633 const argv0 = mem.span(std.os.argv[0]);
635634 if (mem.indexOf(u8, argv0, "/") != null) {
636635 // argv[0] is a path (relative or absolute): use realpath(3) directly
637 var real_path_buf: [MAX_PATH_BYTES]u8 = undefined;
636 var real_path_buf: [max_path_bytes]u8 = undefined;
638637 const real_path = posix.realpathZ(std.os.argv[0], &real_path_buf) catch |err| switch (err) {
639638 error.InvalidWtf8 => unreachable, // Windows-only
640639 error.NetworkNotFound => unreachable, // Windows-only
......@@ -650,13 +649,13 @@ pub fn selfExePath(out_buffer: []u8) SelfExePathError![]u8 {
650649 const PATH = posix.getenvZ("PATH") orelse return error.FileNotFound;
651650 var path_it = mem.tokenizeScalar(u8, PATH, path.delimiter);
652651 while (path_it.next()) |a_path| {
653 var resolved_path_buf: [MAX_PATH_BYTES - 1:0]u8 = undefined;
652 var resolved_path_buf: [max_path_bytes - 1:0]u8 = undefined;
654653 const resolved_path = std.fmt.bufPrintZ(&resolved_path_buf, "{s}/{s}", .{
655654 a_path,
656655 std.os.argv[0],
657656 }) catch continue;
658657
659 var real_path_buf: [MAX_PATH_BYTES]u8 = undefined;
658 var real_path_buf: [max_path_bytes]u8 = undefined;
660659 if (posix.realpathZ(resolved_path, &real_path_buf)) |real_path| {
661660 // found a file, and hope it is the right file
662661 if (real_path.len > out_buffer.len)
......@@ -689,14 +688,14 @@ pub fn selfExePath(out_buffer: []u8) SelfExePathError![]u8 {
689688/// `selfExeDirPath` except allocates the result on the heap.
690689/// Caller owns returned memory.
691690pub fn selfExeDirPathAlloc(allocator: Allocator) ![]u8 {
692 // Use of MAX_PATH_BYTES here is justified as, at least on one tested Linux
691 // Use of max_path_bytes here is justified as, at least on one tested Linux
693692 // system, readlink will completely fail to return a result larger than
694693 // PATH_MAX even if given a sufficiently large buffer. This makes it
695694 // fundamentally impossible to get the selfExeDirPath of a program running
696695 // in a very deeply nested directory chain in this way.
697696 // TODO(#4812): Investigate other systems and whether it is possible to get
698697 // this path by trying larger and larger buffers until one succeeds.
699 var buf: [MAX_PATH_BYTES]u8 = undefined;
698 var buf: [max_path_bytes]u8 = undefined;
700699 return allocator.dupe(u8, try selfExeDirPath(&buf));
701700}
702701
......@@ -716,13 +715,13 @@ pub fn selfExeDirPath(out_buffer: []u8) SelfExePathError![]const u8 {
716715/// On other platforms, the result is an opaque sequence of bytes with no particular encoding.
717716/// See also `Dir.realpath`.
718717pub fn realpathAlloc(allocator: Allocator, pathname: []const u8) ![]u8 {
719 // Use of MAX_PATH_BYTES here is valid as the realpath function does not
718 // Use of max_path_bytes here is valid as the realpath function does not
720719 // have a variant that takes an arbitrary-size buffer.
721720 // TODO(#4812): Consider reimplementing realpath or using the POSIX.1-2008
722721 // NULL out parameter (GNU's canonicalize_file_name) to handle overelong
723722 // paths. musl supports passing NULL but restricts the output to PATH_MAX
724723 // anyway.
725 var buf: [MAX_PATH_BYTES]u8 = undefined;
724 var buf: [max_path_bytes]u8 = undefined;
726725 return allocator.dupe(u8, try posix.realpath(pathname, &buf));
727726}
728727
lib/std/fs/Dir.zig+6-6
......@@ -1309,7 +1309,7 @@ pub fn realpathZ(self: Dir, pathname: [*:0]const u8, out_buffer: []u8) RealPathE
13091309 };
13101310 defer posix.close(fd);
13111311
1312 var buffer: [fs.MAX_PATH_BYTES]u8 = undefined;
1312 var buffer: [fs.max_path_bytes]u8 = undefined;
13131313 const out_path = try std.os.getFdPath(fd, &buffer);
13141314
13151315 if (out_path.len > out_buffer.len) {
......@@ -1347,7 +1347,7 @@ pub fn realpathW(self: Dir, pathname: []const u16, out_buffer: []u8) RealPathErr
13471347
13481348 var wide_buf: [w.PATH_MAX_WIDE]u16 = undefined;
13491349 const wide_slice = try w.GetFinalPathNameByHandle(h_file, .{}, &wide_buf);
1350 var big_out_buf: [fs.MAX_PATH_BYTES]u8 = undefined;
1350 var big_out_buf: [fs.max_path_bytes]u8 = undefined;
13511351 const end_index = std.unicode.wtf16LeToWtf8(&big_out_buf, wide_slice);
13521352 if (end_index > out_buffer.len)
13531353 return error.NameTooLong;
......@@ -1361,13 +1361,13 @@ pub const RealPathAllocError = RealPathError || Allocator.Error;
13611361/// Same as `Dir.realpath` except caller must free the returned memory.
13621362/// See also `Dir.realpath`.
13631363pub fn realpathAlloc(self: Dir, allocator: Allocator, pathname: []const u8) RealPathAllocError![]u8 {
1364 // Use of MAX_PATH_BYTES here is valid as the realpath function does not
1364 // Use of max_path_bytes here is valid as the realpath function does not
13651365 // have a variant that takes an arbitrary-size buffer.
13661366 // TODO(#4812): Consider reimplementing realpath or using the POSIX.1-2008
13671367 // NULL out parameter (GNU's canonicalize_file_name) to handle overelong
13681368 // paths. musl supports passing NULL but restricts the output to PATH_MAX
13691369 // anyway.
1370 var buf: [fs.MAX_PATH_BYTES]u8 = undefined;
1370 var buf: [fs.max_path_bytes]u8 = undefined;
13711371 return allocator.dupe(u8, try self.realpath(pathname, buf[0..]));
13721372}
13731373
......@@ -2192,10 +2192,10 @@ fn deleteTreeMinStackSizeWithKindHint(self: Dir, sub_path: []const u8, kind_hint
21922192 var cleanup_dir = true;
21932193 defer if (cleanup_dir) dir.close();
21942194
2195 // Valid use of MAX_PATH_BYTES because dir_name_buf will only
2195 // Valid use of max_path_bytes because dir_name_buf will only
21962196 // ever store a single path component that was returned from the
21972197 // filesystem.
2198 var dir_name_buf: [fs.MAX_PATH_BYTES]u8 = undefined;
2198 var dir_name_buf: [fs.max_path_bytes]u8 = undefined;
21992199 var dir_name: []const u8 = sub_path;
22002200
22012201 // Here we must avoid recursion, in order to provide O(1) memory guarantee of this function.
lib/std/fs/get_app_data_dir.zig+1-1
......@@ -42,7 +42,7 @@ pub fn getAppDataDir(allocator: mem.Allocator, appname: []const u8) GetAppDataDi
4242 return fs.path.join(allocator, &[_][]const u8{ home_dir, ".local", "share", appname });
4343 },
4444 .haiku => {
45 var dir_path_buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
45 var dir_path_buf: [std.fs.max_path_bytes]u8 = undefined;
4646 const rc = std.c.find_directory(.B_USER_SETTINGS_DIRECTORY, -1, true, &dir_path_buf, dir_path_buf.len);
4747 const settings_dir = try allocator.dupeZ(u8, mem.sliceTo(&dir_path_buf, 0));
4848 defer allocator.free(settings_dir);
lib/std/fs/test.zig+7-7
......@@ -43,7 +43,7 @@ const PathType = enum {
4343 fn transform(allocator: mem.Allocator, dir: Dir, relative_path: [:0]const u8) TransformError![:0]const u8 {
4444 // The final path may not actually exist which would cause realpath to fail.
4545 // So instead, we get the path of the dir and join it with the relative path.
46 var fd_path_buf: [fs.MAX_PATH_BYTES]u8 = undefined;
46 var fd_path_buf: [fs.max_path_bytes]u8 = undefined;
4747 const dir_path = try std.os.getFdPath(dir.fd, &fd_path_buf);
4848 return fs.path.joinZ(allocator, &.{ dir_path, relative_path });
4949 }
......@@ -52,7 +52,7 @@ const PathType = enum {
5252 fn transform(allocator: mem.Allocator, dir: Dir, relative_path: [:0]const u8) TransformError![:0]const u8 {
5353 // Any drive absolute path (C:\foo) can be converted into a UNC path by
5454 // using '127.0.0.1' as the server name and '<drive letter>$' as the share name.
55 var fd_path_buf: [fs.MAX_PATH_BYTES]u8 = undefined;
55 var fd_path_buf: [fs.max_path_bytes]u8 = undefined;
5656 const dir_path = try std.os.getFdPath(dir.fd, &fd_path_buf);
5757 const windows_path_type = windows.getUnprefixedPathType(u8, dir_path);
5858 switch (windows_path_type) {
......@@ -206,13 +206,13 @@ test "Dir.readLink" {
206206}
207207
208208fn testReadLink(dir: Dir, target_path: []const u8, symlink_path: []const u8) !void {
209 var buffer: [fs.MAX_PATH_BYTES]u8 = undefined;
209 var buffer: [fs.max_path_bytes]u8 = undefined;
210210 const actual = try dir.readLink(symlink_path, buffer[0..]);
211211 try testing.expectEqualStrings(target_path, actual);
212212}
213213
214214fn testReadLinkAbsolute(target_path: []const u8, symlink_path: []const u8) !void {
215 var buffer: [fs.MAX_PATH_BYTES]u8 = undefined;
215 var buffer: [fs.max_path_bytes]u8 = undefined;
216216 const given = try fs.readLinkAbsolute(symlink_path, buffer[0..]);
217217 try testing.expectEqualStrings(target_path, given);
218218}
......@@ -611,7 +611,7 @@ test "Dir.realpath smoke test" {
611611 const allocator = ctx.arena.allocator();
612612 const test_file_path = try ctx.transformPath("test_file");
613613 const test_dir_path = try ctx.transformPath("test_dir");
614 var buf: [fs.MAX_PATH_BYTES]u8 = undefined;
614 var buf: [fs.max_path_bytes]u8 = undefined;
615615
616616 // FileNotFound if the path doesn't exist
617617 try testing.expectError(error.FileNotFound, ctx.dir.realpathAlloc(allocator, test_file_path));
......@@ -1041,7 +1041,7 @@ test "openSelfExe" {
10411041test "selfExePath" {
10421042 if (native_os == .wasi) return error.SkipZigTest;
10431043
1044 var buf: [fs.MAX_PATH_BYTES]u8 = undefined;
1044 var buf: [fs.max_path_bytes]u8 = undefined;
10451045 const buf_self_exe_path = try std.fs.selfExePath(&buf);
10461046 const alloc_self_exe_path = try std.fs.selfExePathAlloc(testing.allocator);
10471047 defer testing.allocator.free(alloc_self_exe_path);
......@@ -2061,7 +2061,7 @@ test "invalid UTF-8/WTF-8 paths" {
20612061 try testing.expectError(expected_err, fs.deleteFileAbsolute(invalid_path));
20622062 try testing.expectError(expected_err, fs.deleteFileAbsoluteZ(invalid_path));
20632063 try testing.expectError(expected_err, fs.deleteTreeAbsolute(invalid_path));
2064 var readlink_buf: [fs.MAX_PATH_BYTES]u8 = undefined;
2064 var readlink_buf: [fs.max_path_bytes]u8 = undefined;
20652065 try testing.expectError(expected_err, fs.readLinkAbsolute(invalid_path, &readlink_buf));
20662066 try testing.expectError(expected_err, fs.readLinkAbsoluteZ(invalid_path, &readlink_buf));
20672067 try testing.expectError(expected_err, fs.symLinkAbsolute(invalid_path, invalid_path, .{}));
lib/std/mem.zig+3-6
......@@ -2083,8 +2083,7 @@ test byteSwapAllFields {
20832083 }, k);
20842084}
20852085
2086/// Deprecated: use `tokenizeAny`, `tokenizeSequence`, or `tokenizeScalar`
2087pub const tokenize = tokenizeAny;
2086pub const tokenize = @compileError("deprecated; use tokenizeAny, tokenizeSequence, or tokenizeScalar");
20882087
20892088/// Returns an iterator that iterates over the slices of `buffer` that are not
20902089/// any of the items in `delimiters`.
......@@ -2284,8 +2283,7 @@ test "tokenize (reset)" {
22842283 }
22852284}
22862285
2287/// Deprecated: use `splitSequence`, `splitAny`, or `splitScalar`
2288pub const split = splitSequence;
2286pub const split = @compileError("deprecated; use splitSequence, splitAny, or splitScalar");
22892287
22902288/// Returns an iterator that iterates over the slices of `buffer` that
22912289/// are separated by the byte sequence in `delimiter`.
......@@ -2486,8 +2484,7 @@ test "split (reset)" {
24862484 }
24872485}
24882486
2489/// Deprecated: use `splitBackwardsSequence`, `splitBackwardsAny`, or `splitBackwardsScalar`
2490pub const splitBackwards = splitBackwardsSequence;
2487pub const splitBackwards = @compileError("deprecated; use splitBackwardsSequence, splitBackwardsAny, or splitBackwardsScalar");
24912488
24922489/// Returns an iterator that iterates backwards over the slices of `buffer` that
24932490/// are separated by the sequence in `delimiter`.
lib/std/os.zig+10-10
......@@ -21,7 +21,7 @@ const mem = std.mem;
2121const elf = std.elf;
2222const fs = std.fs;
2323const dl = @import("dynamic_library.zig");
24const MAX_PATH_BYTES = std.fs.MAX_PATH_BYTES;
24const max_path_bytes = std.fs.max_path_bytes;
2525const posix = std.posix;
2626
2727pub const linux = @import("os/linux.zig");
......@@ -99,7 +99,7 @@ pub fn isGetFdPathSupportedOnTarget(os: std.Target.Os) bool {
9999/// * On other platforms, the result is an opaque sequence of bytes with no particular encoding.
100100///
101101/// Calling this function is usually a bug.
102pub fn getFdPath(fd: std.posix.fd_t, out_buffer: *[MAX_PATH_BYTES]u8) std.posix.RealPathError![]u8 {
102pub fn getFdPath(fd: std.posix.fd_t, out_buffer: *[max_path_bytes]u8) std.posix.RealPathError![]u8 {
103103 if (!comptime isGetFdPathSupportedOnTarget(builtin.os)) {
104104 @compileError("querying for canonical path of a handle is unsupported on this host");
105105 }
......@@ -114,7 +114,7 @@ pub fn getFdPath(fd: std.posix.fd_t, out_buffer: *[MAX_PATH_BYTES]u8) std.posix.
114114 .macos, .ios, .watchos, .tvos, .visionos => {
115115 // On macOS, we can use F.GETPATH fcntl command to query the OS for
116116 // the path to the file descriptor.
117 @memset(out_buffer[0..MAX_PATH_BYTES], 0);
117 @memset(out_buffer[0..max_path_bytes], 0);
118118 switch (posix.errno(posix.system.fcntl(fd, posix.F.GETPATH, out_buffer))) {
119119 .SUCCESS => {},
120120 .BADF => return error.FileNotFound,
......@@ -123,7 +123,7 @@ pub fn getFdPath(fd: std.posix.fd_t, out_buffer: *[MAX_PATH_BYTES]u8) std.posix.
123123 // errno values to expect when command is F.GETPATH...
124124 else => |err| return posix.unexpectedErrno(err),
125125 }
126 const len = mem.indexOfScalar(u8, out_buffer[0..], 0) orelse MAX_PATH_BYTES;
126 const len = mem.indexOfScalar(u8, out_buffer[0..], 0) orelse max_path_bytes;
127127 return out_buffer[0..len];
128128 },
129129 .linux => {
......@@ -163,7 +163,7 @@ pub fn getFdPath(fd: std.posix.fd_t, out_buffer: *[MAX_PATH_BYTES]u8) std.posix.
163163 .BADF => return error.FileNotFound,
164164 else => |err| return posix.unexpectedErrno(err),
165165 }
166 const len = mem.indexOfScalar(u8, &kfile.path, 0) orelse MAX_PATH_BYTES;
166 const len = mem.indexOfScalar(u8, &kfile.path, 0) orelse max_path_bytes;
167167 if (len == 0) return error.NameTooLong;
168168 const result = out_buffer[0..len];
169169 @memcpy(result, kfile.path[0..len]);
......@@ -196,7 +196,7 @@ pub fn getFdPath(fd: std.posix.fd_t, out_buffer: *[MAX_PATH_BYTES]u8) std.posix.
196196 while (i < len) {
197197 const kf: *align(1) std.c.kinfo_file = @ptrCast(&buf[i]);
198198 if (kf.fd == fd) {
199 len = mem.indexOfScalar(u8, &kf.path, 0) orelse MAX_PATH_BYTES;
199 len = mem.indexOfScalar(u8, &kf.path, 0) orelse max_path_bytes;
200200 if (len == 0) return error.NameTooLong;
201201 const result = out_buffer[0..len];
202202 @memcpy(result, kf.path[0..len]);
......@@ -208,18 +208,18 @@ pub fn getFdPath(fd: std.posix.fd_t, out_buffer: *[MAX_PATH_BYTES]u8) std.posix.
208208 }
209209 },
210210 .dragonfly => {
211 @memset(out_buffer[0..MAX_PATH_BYTES], 0);
211 @memset(out_buffer[0..max_path_bytes], 0);
212212 switch (posix.errno(std.c.fcntl(fd, posix.F.GETPATH, out_buffer))) {
213213 .SUCCESS => {},
214214 .BADF => return error.FileNotFound,
215215 .RANGE => return error.NameTooLong,
216216 else => |err| return posix.unexpectedErrno(err),
217217 }
218 const len = mem.indexOfScalar(u8, out_buffer[0..], 0) orelse MAX_PATH_BYTES;
218 const len = mem.indexOfScalar(u8, out_buffer[0..], 0) orelse max_path_bytes;
219219 return out_buffer[0..len];
220220 },
221221 .netbsd => {
222 @memset(out_buffer[0..MAX_PATH_BYTES], 0);
222 @memset(out_buffer[0..max_path_bytes], 0);
223223 switch (posix.errno(std.c.fcntl(fd, posix.F.GETPATH, out_buffer))) {
224224 .SUCCESS => {},
225225 .ACCES => return error.AccessDenied,
......@@ -229,7 +229,7 @@ pub fn getFdPath(fd: std.posix.fd_t, out_buffer: *[MAX_PATH_BYTES]u8) std.posix.
229229 .RANGE => return error.NameTooLong,
230230 else => |err| return posix.unexpectedErrno(err),
231231 }
232 const len = mem.indexOfScalar(u8, out_buffer[0..], 0) orelse MAX_PATH_BYTES;
232 const len = mem.indexOfScalar(u8, out_buffer[0..], 0) orelse max_path_bytes;
233233 return out_buffer[0..len];
234234 },
235235 else => unreachable, // made unreachable by isGetFdPathSupportedOnTarget above
lib/std/os/linux/IoUring.zig+2-2
......@@ -3995,7 +3995,7 @@ test "ring mapped buffers recv" {
39953995 defer fds.close();
39963996
39973997 // for random user_data in sqe/cqe
3998 var Rnd = std.rand.DefaultPrng.init(0);
3998 var Rnd = std.Random.DefaultPrng.init(0);
39993999 var rnd = Rnd.random();
40004000
40014001 var round: usize = 4; // repeat send/recv cycle round times
......@@ -4081,7 +4081,7 @@ test "ring mapped buffers multishot recv" {
40814081 defer fds.close();
40824082
40834083 // for random user_data in sqe/cqe
4084 var Rnd = std.rand.DefaultPrng.init(0);
4084 var Rnd = std.Random.DefaultPrng.init(0);
40854085 var rnd = Rnd.random();
40864086
40874087 var round: usize = 4; // repeat send/recv cycle round times
lib/std/os/plan9.zig+5-5
......@@ -285,16 +285,16 @@ pub fn openat(dirfd: i32, path: [*:0]const u8, flags: u32, _: mode_t) usize {
285285 if (dirfd == AT.FDCWD) { // openat(AT_FDCWD, ...) == open(...)
286286 return open(path, flags);
287287 }
288 var dir_path_buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
289 var total_path_buf: [std.fs.MAX_PATH_BYTES + 1]u8 = undefined;
290 const rc = fd2path(dirfd, &dir_path_buf, std.fs.MAX_PATH_BYTES);
288 var dir_path_buf: [std.fs.max_path_bytes]u8 = undefined;
289 var total_path_buf: [std.fs.max_path_bytes + 1]u8 = undefined;
290 const rc = fd2path(dirfd, &dir_path_buf, std.fs.max_path_bytes);
291291 if (rc != 0) return rc;
292292 var fba = std.heap.FixedBufferAllocator.init(&total_path_buf);
293293 var alloc = fba.allocator();
294294 const dir_path = std.mem.span(@as([*:0]u8, @ptrCast(&dir_path_buf)));
295 const total_path = std.fs.path.join(alloc, &.{ dir_path, std.mem.span(path) }) catch unreachable; // the allocation shouldn't fail because it should not exceed MAX_PATH_BYTES
295 const total_path = std.fs.path.join(alloc, &.{ dir_path, std.mem.span(path) }) catch unreachable; // the allocation shouldn't fail because it should not exceed max_path_bytes
296296 fba.reset();
297 const total_path_z = alloc.dupeZ(u8, total_path) catch unreachable; // should not exceed MAX_PATH_BYTES + 1
297 const total_path_z = alloc.dupeZ(u8, total_path) catch unreachable; // should not exceed max_path_bytes + 1
298298 return open(total_path_z.ptr, flags);
299299}
300300
lib/std/os/windows/test.zig+2-2
......@@ -30,7 +30,7 @@ fn testToPrefixedFileNoOracle(comptime path: []const u8, comptime expected_path:
3030 const expected_path_utf16 = std.unicode.utf8ToUtf16LeStringLiteral(expected_path);
3131 const actual_path = try windows.wToPrefixedFileW(null, path_utf16);
3232 std.testing.expectEqualSlices(u16, expected_path_utf16, actual_path.span()) catch |e| {
33 std.debug.print("got '{s}', expected '{s}'\n", .{ std.unicode.fmtUtf16Le(actual_path.span()), std.unicode.fmtUtf16le(expected_path_utf16) });
33 std.debug.print("got '{s}', expected '{s}'\n", .{ std.unicode.fmtUtf16Le(actual_path.span()), std.unicode.fmtUtf16Le(expected_path_utf16) });
3434 return e;
3535 };
3636}
......@@ -48,7 +48,7 @@ fn testToPrefixedFileOnlyOracle(comptime path: []const u8) !void {
4848 const zig_result = try windows.wToPrefixedFileW(null, path_utf16);
4949 const win32_api_result = try RtlDosPathNameToNtPathName_U(path_utf16);
5050 std.testing.expectEqualSlices(u16, win32_api_result.span(), zig_result.span()) catch |e| {
51 std.debug.print("got '{s}', expected '{s}'\n", .{ std.unicode.fmtUtf16Le(zig_result.span()), std.unicode.fmtUtf16le(win32_api_result.span()) });
51 std.debug.print("got '{s}', expected '{s}'\n", .{ std.unicode.fmtUtf16Le(zig_result.span()), std.unicode.fmtUtf16Le(win32_api_result.span()) });
5252 return e;
5353 };
5454}
lib/std/posix.zig+1-1
......@@ -19,7 +19,7 @@ const root = @import("root");
1919const std = @import("std.zig");
2020const mem = std.mem;
2121const fs = std.fs;
22const max_path_bytes = fs.MAX_PATH_BYTES;
22const max_path_bytes = fs.max_path_bytes;
2323const maxInt = std.math.maxInt;
2424const cast = std.math.cast;
2525const assert = std.debug.assert;
lib/std/posix/test.zig+10-10
......@@ -31,13 +31,13 @@ test "chdir smoke test" {
3131 }
3232
3333 // Get current working directory path
34 var old_cwd_buf: [fs.MAX_PATH_BYTES]u8 = undefined;
34 var old_cwd_buf: [fs.max_path_bytes]u8 = undefined;
3535 const old_cwd = try posix.getcwd(old_cwd_buf[0..]);
3636
3737 {
3838 // Firstly, changing to itself should have no effect
3939 try posix.chdir(old_cwd);
40 var new_cwd_buf: [fs.MAX_PATH_BYTES]u8 = undefined;
40 var new_cwd_buf: [fs.max_path_bytes]u8 = undefined;
4141 const new_cwd = try posix.getcwd(new_cwd_buf[0..]);
4242 try expect(mem.eql(u8, old_cwd, new_cwd));
4343 }
......@@ -50,7 +50,7 @@ test "chdir smoke test" {
5050 // Restore cwd because process may have other tests that do not tolerate chdir.
5151 defer posix.chdir(old_cwd) catch unreachable;
5252
53 var new_cwd_buf: [fs.MAX_PATH_BYTES]u8 = undefined;
53 var new_cwd_buf: [fs.max_path_bytes]u8 = undefined;
5454 const new_cwd = try posix.getcwd(new_cwd_buf[0..]);
5555 try expect(mem.eql(u8, parent, new_cwd));
5656 }
......@@ -58,7 +58,7 @@ test "chdir smoke test" {
5858 // Next, change current working directory to a temp directory one level below
5959 {
6060 // Create a tmp directory
61 var tmp_dir_buf: [fs.MAX_PATH_BYTES]u8 = undefined;
61 var tmp_dir_buf: [fs.max_path_bytes]u8 = undefined;
6262 const tmp_dir_path = path: {
6363 var allocator = std.heap.FixedBufferAllocator.init(&tmp_dir_buf);
6464 break :path try fs.path.resolve(allocator.allocator(), &[_][]const u8{ old_cwd, "zig-test-tmp" });
......@@ -68,11 +68,11 @@ test "chdir smoke test" {
6868 // Change current working directory to tmp directory
6969 try posix.chdir("zig-test-tmp");
7070
71 var new_cwd_buf: [fs.MAX_PATH_BYTES]u8 = undefined;
71 var new_cwd_buf: [fs.max_path_bytes]u8 = undefined;
7272 const new_cwd = try posix.getcwd(new_cwd_buf[0..]);
7373
7474 // On Windows, fs.path.resolve returns an uppercase drive letter, but the drive letter returned by getcwd may be lowercase
75 var resolved_cwd_buf: [fs.MAX_PATH_BYTES]u8 = undefined;
75 var resolved_cwd_buf: [fs.max_path_bytes]u8 = undefined;
7676 const resolved_cwd = path: {
7777 var allocator = std.heap.FixedBufferAllocator.init(&resolved_cwd_buf);
7878 break :path try fs.path.resolve(allocator.allocator(), &[_][]const u8{new_cwd});
......@@ -230,7 +230,7 @@ test "symlink with relative paths" {
230230 try posix.symlink("file.txt", "symlinked");
231231 }
232232
233 var buffer: [fs.MAX_PATH_BYTES]u8 = undefined;
233 var buffer: [fs.max_path_bytes]u8 = undefined;
234234 const given = try posix.readlink("symlinked", buffer[0..]);
235235 try expect(mem.eql(u8, "file.txt", given));
236236
......@@ -247,7 +247,7 @@ test "readlink on Windows" {
247247}
248248
249249fn testReadlink(target_path: []const u8, symlink_path: []const u8) !void {
250 var buffer: [fs.MAX_PATH_BYTES]u8 = undefined;
250 var buffer: [fs.max_path_bytes]u8 = undefined;
251251 const given = try posix.readlink(symlink_path, buffer[0..]);
252252 try expect(mem.eql(u8, target_path, given));
253253}
......@@ -385,7 +385,7 @@ test "readlinkat" {
385385 }
386386
387387 // read the link
388 var buffer: [fs.MAX_PATH_BYTES]u8 = undefined;
388 var buffer: [fs.max_path_bytes]u8 = undefined;
389389 const read_link = try posix.readlinkat(tmp.dir.fd, "link", buffer[0..]);
390390 try expect(mem.eql(u8, "file.txt", read_link));
391391}
......@@ -466,7 +466,7 @@ test "getrandom" {
466466
467467test "getcwd" {
468468 // at least call it so it gets compiled
469 var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
469 var buf: [std.fs.max_path_bytes]u8 = undefined;
470470 _ = posix.getcwd(&buf) catch undefined;
471471}
472472
lib/std/process.zig+3-3
......@@ -32,9 +32,9 @@ pub const GetCwdAllocError = Allocator.Error || posix.GetCwdError;
3232/// On Windows, the result is encoded as [WTF-8](https://simonsapin.github.io/wtf-8/).
3333/// On other platforms, the result is an opaque sequence of bytes with no particular encoding.
3434pub fn getCwdAlloc(allocator: Allocator) ![]u8 {
35 // The use of MAX_PATH_BYTES here is just a heuristic: most paths will fit
35 // The use of max_path_bytes here is just a heuristic: most paths will fit
3636 // in stack_buf, avoiding an extra allocation in the common case.
37 var stack_buf: [fs.MAX_PATH_BYTES]u8 = undefined;
37 var stack_buf: [fs.max_path_bytes]u8 = undefined;
3838 var heap_buf: ?[]u8 = null;
3939 defer if (heap_buf) |buf| allocator.free(buf);
4040
......@@ -1618,7 +1618,7 @@ pub const can_execv = switch (native_os) {
16181618 else => true,
16191619};
16201620
1621/// Tells whether spawning child processes is supported (e.g. via ChildProcess)
1621/// Tells whether spawning child processes is supported (e.g. via Child)
16221622pub const can_spawn = switch (native_os) {
16231623 .wasi, .watchos, .tvos, .visionos => false,
16241624 else => true,
lib/std/std.zig-4
......@@ -43,8 +43,6 @@ pub const StringHashMap = hash_map.StringHashMap;
4343pub const StringHashMapUnmanaged = hash_map.StringHashMapUnmanaged;
4444pub const StringArrayHashMap = array_hash_map.StringArrayHashMap;
4545pub const StringArrayHashMapUnmanaged = array_hash_map.StringArrayHashMapUnmanaged;
46/// deprecated: use `DoublyLinkedList`.
47pub const TailQueue = DoublyLinkedList;
4846pub const Target = @import("Target.zig");
4947pub const Thread = @import("Thread.zig");
5048pub const Treap = @import("treap.zig").Treap;
......@@ -88,8 +86,6 @@ pub const packed_int_array = @import("packed_int_array.zig");
8886pub const pdb = @import("pdb.zig");
8987pub const posix = @import("posix.zig");
9088pub const process = @import("process.zig");
91/// Deprecated: use `Random` instead.
92pub const rand = Random;
9389pub const sort = @import("sort.zig");
9490pub const simd = @import("simd.zig");
9591pub const ascii = @import("ascii.zig");
lib/std/tar.zig+6-6
......@@ -283,9 +283,9 @@ fn nullStr(str: []const u8) []const u8 {
283283/// Options for iterator.
284284/// Buffers should be provided by the caller.
285285pub const IteratorOptions = struct {
286 /// Use a buffer with length `std.fs.MAX_PATH_BYTES` to match file system capabilities.
286 /// Use a buffer with length `std.fs.max_path_bytes` to match file system capabilities.
287287 file_name_buffer: []u8,
288 /// Use a buffer with length `std.fs.MAX_PATH_BYTES` to match file system capabilities.
288 /// Use a buffer with length `std.fs.max_path_bytes` to match file system capabilities.
289289 link_name_buffer: []u8,
290290 /// Collects error messages during unpacking
291291 diagnostics: ?*Diagnostics = null,
......@@ -613,8 +613,8 @@ fn PaxIterator(comptime ReaderType: type) type {
613613
614614/// Saves tar file content to the file systems.
615615pub fn pipeToFileSystem(dir: std.fs.Dir, reader: anytype, options: PipeOptions) !void {
616 var file_name_buffer: [std.fs.MAX_PATH_BYTES]u8 = undefined;
617 var link_name_buffer: [std.fs.MAX_PATH_BYTES]u8 = undefined;
616 var file_name_buffer: [std.fs.max_path_bytes]u8 = undefined;
617 var link_name_buffer: [std.fs.max_path_bytes]u8 = undefined;
618618 var iter = iterator(reader, .{
619619 .file_name_buffer = &file_name_buffer,
620620 .link_name_buffer = &link_name_buffer,
......@@ -946,8 +946,8 @@ test iterator {
946946 var fbs = std.io.fixedBufferStream(data);
947947
948948 // User provided buffers to the iterator
949 var file_name_buffer: [std.fs.MAX_PATH_BYTES]u8 = undefined;
950 var link_name_buffer: [std.fs.MAX_PATH_BYTES]u8 = undefined;
949 var file_name_buffer: [std.fs.max_path_bytes]u8 = undefined;
950 var link_name_buffer: [std.fs.max_path_bytes]u8 = undefined;
951951 // Create iterator
952952 var iter = iterator(fbs.reader(), .{
953953 .file_name_buffer = &file_name_buffer,
lib/std/tar/test.zig+2-2
......@@ -342,8 +342,8 @@ const Md5Writer = struct {
342342};
343343
344344test "run test cases" {
345 var file_name_buffer: [std.fs.MAX_PATH_BYTES]u8 = undefined;
346 var link_name_buffer: [std.fs.MAX_PATH_BYTES]u8 = undefined;
345 var file_name_buffer: [std.fs.max_path_bytes]u8 = undefined;
346 var link_name_buffer: [std.fs.max_path_bytes]u8 = undefined;
347347
348348 for (cases) |case| {
349349 var fsb = std.io.fixedBufferStream(case.data);
lib/std/unicode.zig+6-11
......@@ -983,8 +983,7 @@ pub fn utf16LeToUtf8ArrayList(result: *std.ArrayList(u8), utf16le: []const u16)
983983 return utf16LeToUtf8ArrayListImpl(result, utf16le, .cannot_encode_surrogate_half);
984984}
985985
986/// Deprecated; renamed to utf16LeToUtf8Alloc
987pub const utf16leToUtf8Alloc = utf16LeToUtf8Alloc;
986pub const utf16leToUtf8Alloc = @compileError("deprecated; renamed to utf16LeToUtf8Alloc");
988987
989988/// Caller must free returned memory.
990989pub fn utf16LeToUtf8Alloc(allocator: mem.Allocator, utf16le: []const u16) Utf16LeToUtf8AllocError![]u8 {
......@@ -996,8 +995,7 @@ pub fn utf16LeToUtf8Alloc(allocator: mem.Allocator, utf16le: []const u16) Utf16L
996995 return result.toOwnedSlice();
997996}
998997
999/// Deprecated; renamed to utf16LeToUtf8AllocZ
1000pub const utf16leToUtf8AllocZ = utf16LeToUtf8AllocZ;
998pub const utf16leToUtf8AllocZ = @compileError("deprecated; renamed to utf16LeToUtf8AllocZ");
1001999
10021000/// Caller must free returned memory.
10031001pub fn utf16LeToUtf8AllocZ(allocator: mem.Allocator, utf16le: []const u16) Utf16LeToUtf8AllocError![:0]u8 {
......@@ -1067,8 +1065,7 @@ fn utf16LeToUtf8Impl(utf8: []u8, utf16le: []const u16, comptime surrogates: Surr
10671065 return dest_index;
10681066}
10691067
1070/// Deprecated; renamed to utf16LeToUtf8
1071pub const utf16leToUtf8 = utf16LeToUtf8;
1068pub const utf16leToUtf8 = @compileError("deprecated; renamed to utf16LeToUtf8");
10721069
10731070pub fn utf16LeToUtf8(utf8: []u8, utf16le: []const u16) Utf16LeToUtf8Error!usize {
10741071 return utf16LeToUtf8Impl(utf8, utf16le, .cannot_encode_surrogate_half);
......@@ -1189,8 +1186,7 @@ pub fn utf8ToUtf16LeAlloc(allocator: mem.Allocator, utf8: []const u8) error{ Inv
11891186 return result.toOwnedSlice();
11901187}
11911188
1192/// Deprecated; renamed to utf8ToUtf16LeAllocZ
1193pub const utf8ToUtf16LeWithNull = utf8ToUtf16LeAllocZ;
1189pub const utf8ToUtf16LeWithNull = @compileError("deprecated; renamed to utf8ToUtf16LeAllocZ");
11941190
11951191pub fn utf8ToUtf16LeAllocZ(allocator: mem.Allocator, utf8: []const u8) error{ InvalidUtf8, OutOfMemory }![:0]u16 {
11961192 // optimistically guess that it will not require surrogate pairs
......@@ -1335,7 +1331,7 @@ test utf8ToUtf16LeAllocZ {
13351331 try testing.expectError(error.InvalidUtf8, result);
13361332 }
13371333 {
1338 const utf16 = try utf8ToUtf16LeWithNull(testing.allocator, "This string has been designed to test the vectorized implementat" ++
1334 const utf16 = try utf8ToUtf16LeAllocZ(testing.allocator, "This string has been designed to test the vectorized implementat" ++
13391335 "ion by beginning with one hundred twenty-seven ASCII characters¡");
13401336 defer testing.allocator.free(utf16);
13411337 try testing.expectEqualSlices(u8, &.{
......@@ -1479,8 +1475,7 @@ fn formatUtf16Le(
14791475 try writer.writeAll(buf[0..u8len]);
14801476}
14811477
1482/// Deprecated; renamed to fmtUtf16Le
1483pub const fmtUtf16le = fmtUtf16Le;
1478pub const fmtUtf16le = @compileError("deprecated; renamed to fmtUtf16Le");
14841479
14851480/// Return a Formatter for a (potentially ill-formed) UTF-16 LE string,
14861481/// which will be converted to UTF-8 during formatting.
lib/std/zig.zig+1-2
......@@ -15,8 +15,7 @@ pub const Ast = @import("zig/Ast.zig");
1515pub const AstGen = @import("zig/AstGen.zig");
1616pub const Zir = @import("zig/Zir.zig");
1717pub const system = @import("zig/system.zig");
18/// Deprecated: use `std.Target.Query`.
19pub const CrossTarget = std.Target.Query;
18pub const CrossTarget = @compileError("deprecated; use std.Target.Query");
2019pub const BuiltinFn = @import("zig/BuiltinFn.zig");
2120pub const AstRlAnnotate = @import("zig/AstRlAnnotate.zig");
2221pub const LibCInstallation = @import("zig/LibCInstallation.zig");
lib/std/zig/WindowsSdk.zig+7-7
......@@ -444,7 +444,7 @@ pub const Installation = struct {
444444
445445 error.OutOfMemory => return error.OutOfMemory,
446446 };
447 if (path_maybe_with_trailing_slash.len > std.fs.MAX_PATH_BYTES or !std.fs.path.isAbsolute(path_maybe_with_trailing_slash)) {
447 if (path_maybe_with_trailing_slash.len > std.fs.max_path_bytes or !std.fs.path.isAbsolute(path_maybe_with_trailing_slash)) {
448448 allocator.free(path_maybe_with_trailing_slash);
449449 return error.PathTooLong;
450450 }
......@@ -459,7 +459,7 @@ pub const Installation = struct {
459459 errdefer allocator.free(path);
460460
461461 const version = version: {
462 var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
462 var buf: [std.fs.max_path_bytes]u8 = undefined;
463463 const sdk_lib_dir_path = std.fmt.bufPrint(buf[0..], "{s}\\Lib\\", .{path}) catch |err| switch (err) {
464464 error.NoSpaceLeft => return error.PathTooLong,
465465 };
......@@ -516,7 +516,7 @@ pub const Installation = struct {
516516 error.OutOfMemory => return error.OutOfMemory,
517517 };
518518
519 if (path_maybe_with_trailing_slash.len > std.fs.MAX_PATH_BYTES or !std.fs.path.isAbsolute(path_maybe_with_trailing_slash)) {
519 if (path_maybe_with_trailing_slash.len > std.fs.max_path_bytes or !std.fs.path.isAbsolute(path_maybe_with_trailing_slash)) {
520520 allocator.free(path_maybe_with_trailing_slash);
521521 return error.PathTooLong;
522522 }
......@@ -562,7 +562,7 @@ pub const Installation = struct {
562562
563563 /// Check whether this version is enumerated in registry.
564564 fn isValidVersion(installation: Installation) bool {
565 var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
565 var buf: [std.fs.max_path_bytes]u8 = undefined;
566566 const reg_query_as_wtf8 = std.fmt.bufPrint(buf[0..], "{s}\\{s}\\Installed Options", .{
567567 windows_kits_reg_key,
568568 installation.version,
......@@ -878,7 +878,7 @@ const MsvcLibDir = struct {
878878 error.OutOfMemory => return error.OutOfMemory,
879879 else => continue,
880880 };
881 if (source_directories_value.len > (std.fs.MAX_PATH_BYTES * 30)) { // note(bratishkaerik): guessing from the fact that on my computer it has 15 pathes and at least some of them are not of max length
881 if (source_directories_value.len > (std.fs.max_path_bytes * 30)) { // note(bratishkaerik): guessing from the fact that on my computer it has 15 pathes and at least some of them are not of max length
882882 allocator.free(source_directories_value);
883883 continue;
884884 }
......@@ -892,7 +892,7 @@ const MsvcLibDir = struct {
892892 const msvc_dir: []const u8 = msvc_dir: {
893893 const msvc_include_dir_maybe_with_trailing_slash = try allocator.dupe(u8, source_directories_splitted.first());
894894
895 if (msvc_include_dir_maybe_with_trailing_slash.len > std.fs.MAX_PATH_BYTES or !std.fs.path.isAbsolute(msvc_include_dir_maybe_with_trailing_slash)) {
895 if (msvc_include_dir_maybe_with_trailing_slash.len > std.fs.max_path_bytes or !std.fs.path.isAbsolute(msvc_include_dir_maybe_with_trailing_slash)) {
896896 allocator.free(msvc_include_dir_maybe_with_trailing_slash);
897897 return error.PathNotFound;
898898 }
......@@ -960,7 +960,7 @@ const MsvcLibDir = struct {
960960 else => break :try_vs7_key,
961961 };
962962
963 if (path_maybe_with_trailing_slash.len > std.fs.MAX_PATH_BYTES or !std.fs.path.isAbsolute(path_maybe_with_trailing_slash)) {
963 if (path_maybe_with_trailing_slash.len > std.fs.max_path_bytes or !std.fs.path.isAbsolute(path_maybe_with_trailing_slash)) {
964964 allocator.free(path_maybe_with_trailing_slash);
965965 break :try_vs7_key;
966966 }
lib/std/zip.zig+1-1
......@@ -583,7 +583,7 @@ pub fn extract(dest: std.fs.Dir, seekable_stream: anytype, options: ExtractOptio
583583 const SeekableStream = @TypeOf(seekable_stream);
584584 var iter = try Iterator(SeekableStream).init(seekable_stream);
585585
586 var filename_buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
586 var filename_buf: [std.fs.max_path_bytes]u8 = undefined;
587587 while (try iter.next()) |entry| {
588588 const crc32 = try entry.extract(seekable_stream, options, &filename_buf, dest);
589589 if (crc32 != entry.crc32)
lib/std/zip/test.zig+1-1
......@@ -17,7 +17,7 @@ pub fn expectFiles(
1717 },
1818) !void {
1919 for (test_files) |test_file| {
20 var normalized_sub_path_buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
20 var normalized_sub_path_buf: [std.fs.max_path_bytes]u8 = undefined;
2121
2222 const name = blk: {
2323 if (opt.strip_prefix) |strip_prefix| {
src/Builtin.zig+1-1
......@@ -266,7 +266,7 @@ pub fn populateFile(comp: *Compilation, mod: *Module, file: *File) !void {
266266}
267267
268268fn writeFile(file: *File, mod: *Module) !void {
269 var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
269 var buf: [std.fs.max_path_bytes]u8 = undefined;
270270 var af = try mod.root.atomicFile(mod.root_src_path, .{ .make_path = true }, &buf);
271271 defer af.deinit();
272272 try af.file.writeAll(file.source);
src/Package/Fetch.zig+2-2
......@@ -1364,7 +1364,7 @@ fn recursiveDirectoryCopy(f: *Fetch, dir: fs.Dir, tmp_dir: fs.Dir) anyerror!void
13641364 };
13651365 },
13661366 .sym_link => {
1367 var buf: [fs.MAX_PATH_BYTES]u8 = undefined;
1367 var buf: [fs.max_path_bytes]u8 = undefined;
13681368 const link_name = try dir.readLink(entry.path, &buf);
13691369 // TODO: if this would create a symlink to outside
13701370 // the destination directory, fail with an error instead.
......@@ -1748,7 +1748,7 @@ pub fn depDigest(
17481748 switch (dep.location) {
17491749 .url => return null,
17501750 .path => |rel_path| {
1751 var buf: [fs.MAX_PATH_BYTES]u8 = undefined;
1751 var buf: [fs.max_path_bytes]u8 = undefined;
17521752 var fba = std.heap.FixedBufferAllocator.init(&buf);
17531753 const new_root = pkg_root.resolvePosix(fba.allocator(), rel_path) catch
17541754 return null;
src/codegen/llvm.zig+1-1
......@@ -1975,7 +1975,7 @@ pub const Object = struct {
19751975 defer gpa.free(dir_path);
19761976 if (std.fs.path.isAbsolute(dir_path))
19771977 break :dir_path try o.builder.metadataString(dir_path);
1978 var abs_buffer: [std.fs.MAX_PATH_BYTES]u8 = undefined;
1978 var abs_buffer: [std.fs.max_path_bytes]u8 = undefined;
19791979 const abs_path = std.fs.realpath(dir_path, &abs_buffer) catch
19801980 break :dir_path try o.builder.metadataString(dir_path);
19811981 break :dir_path try o.builder.metadataString(abs_path);
src/link/Dwarf.zig+3-3
......@@ -2006,7 +2006,7 @@ pub fn writeDbgInfoHeader(self: *Dwarf, zcu: *Module, low_pc: u64, high_pc: u64)
20062006
20072007 // Write the form for the compile unit, which must match the abbrev table above.
20082008 const name_strp = try self.strtab.insert(self.allocator, zcu.root_mod.root_src_path);
2009 var compile_unit_dir_buffer: [std.fs.MAX_PATH_BYTES]u8 = undefined;
2009 var compile_unit_dir_buffer: [std.fs.max_path_bytes]u8 = undefined;
20102010 const compile_unit_dir = resolveCompilationDir(zcu, &compile_unit_dir_buffer);
20112011 const comp_dir_strp = try self.strtab.insert(self.allocator, compile_unit_dir);
20122012 const producer_strp = try self.strtab.insert(self.allocator, link.producer_string);
......@@ -2058,7 +2058,7 @@ pub fn writeDbgInfoHeader(self: *Dwarf, zcu: *Module, low_pc: u64, high_pc: u64)
20582058 }
20592059}
20602060
2061fn resolveCompilationDir(module: *Module, buffer: *[std.fs.MAX_PATH_BYTES]u8) []const u8 {
2061fn resolveCompilationDir(module: *Module, buffer: *[std.fs.max_path_bytes]u8) []const u8 {
20622062 // We fully resolve all paths at this point to avoid lack of source line info in stack
20632063 // traces or lack of debugging information which, if relative paths were used, would
20642064 // be very location dependent.
......@@ -2804,7 +2804,7 @@ fn genIncludeDirsAndFileNames(self: *Dwarf, arena: Allocator) !struct {
28042804 const dir_path = std.fs.path.dirname(full_path) orelse ".";
28052805 const sub_file_path = std.fs.path.basename(full_path);
28062806 // https://github.com/ziglang/zig/issues/19353
2807 var buffer: [std.fs.MAX_PATH_BYTES]u8 = undefined;
2807 var buffer: [std.fs.max_path_bytes]u8 = undefined;
28082808 const resolved = if (!std.fs.path.isAbsolute(dir_path))
28092809 std.posix.realpath(dir_path, &buffer) catch dir_path
28102810 else
src/link/Elf.zig+2-2
......@@ -1831,7 +1831,7 @@ fn parseLdScript(self: *Elf, lib: SystemLib) ParseError!void {
18311831 break :success;
18321832 }
18331833 } else {
1834 var buffer: [fs.MAX_PATH_BYTES]u8 = undefined;
1834 var buffer: [fs.max_path_bytes]u8 = undefined;
18351835 if (fs.realpath(scr_obj.path, &buffer)) |path| {
18361836 test_path.clearRetainingCapacity();
18371837 try test_path.writer().writeAll(path);
......@@ -3706,7 +3706,7 @@ fn sortInitFini(self: *Elf) !void {
37063706 }
37073707 const default: i32 = if (is_ctor_dtor) -1 else std.math.maxInt(i32);
37083708 const name = atom_ptr.name(self);
3709 var it = mem.splitBackwards(u8, name, ".");
3709 var it = mem.splitBackwardsScalar(u8, name, '.');
37103710 const priority = std.fmt.parseUnsigned(u16, it.first(), 10) catch default;
37113711 break :blk priority;
37123712 };
src/link/MachO.zig+2-2
......@@ -1230,7 +1230,7 @@ fn parseDependentDylibs(self: *MachO) !void {
12301230 const prefix = eatPrefix(rpath, "@loader_path/") orelse rpath;
12311231 const rel_path = try fs.path.join(arena, &.{ prefix, path });
12321232 try checked_paths.append(rel_path);
1233 var buffer: [fs.MAX_PATH_BYTES]u8 = undefined;
1233 var buffer: [fs.max_path_bytes]u8 = undefined;
12341234 const full_path = fs.realpath(rel_path, &buffer) catch continue;
12351235 break :full_path try arena.dupe(u8, full_path);
12361236 }
......@@ -1243,7 +1243,7 @@ fn parseDependentDylibs(self: *MachO) !void {
12431243 }
12441244
12451245 try checked_paths.append(try arena.dupe(u8, id.name));
1246 var buffer: [fs.MAX_PATH_BYTES]u8 = undefined;
1246 var buffer: [fs.max_path_bytes]u8 = undefined;
12471247 if (fs.realpath(id.name, &buffer)) |full_path| {
12481248 break :full_path try arena.dupe(u8, full_path);
12491249 } else |_| {
src/link/MachO/Dylib.zig+1-1
......@@ -831,7 +831,7 @@ pub const Id = struct {
831831 var out: u32 = 0;
832832 var values: [3][]const u8 = undefined;
833833
834 var split = mem.split(u8, string, ".");
834 var split = mem.splitScalar(u8, string, '.');
835835 var count: u4 = 0;
836836 while (split.next()) |value| {
837837 if (count > 2) {
src/link/Plan9.zig+1-1
......@@ -365,7 +365,7 @@ fn putFn(self: *Plan9, decl_index: InternPool.DeclIndex, out: FnDeclOutput) !voi
365365 try a.writer().writeInt(u16, 1, .big);
366366
367367 // getting the full file path
368 var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
368 var buf: [std.fs.max_path_bytes]u8 = undefined;
369369 const full_path = try std.fs.path.join(arena, &.{
370370 file.mod.root.root_dir.path orelse try std.posix.getcwd(&buf),
371371 file.mod.root.sub_path,
src/link/Wasm/Archive.zig+1-1
......@@ -192,7 +192,7 @@ pub fn parseObject(archive: Archive, wasm_file: *const Wasm, file_offset: u32) !
192192
193193 const object_name = try archive.parseName(header);
194194 const name = name: {
195 var buffer: [std.fs.MAX_PATH_BYTES]u8 = undefined;
195 var buffer: [std.fs.max_path_bytes]u8 = undefined;
196196 const path = try std.posix.realpath(archive.name, &buffer);
197197 break :name try std.fmt.allocPrint(gpa, "{s}({s})", .{ path, object_name });
198198 };
test/standalone/self_exe_symlink/main.zig+1-1
......@@ -10,7 +10,7 @@ pub fn main() !void {
1010
1111 var self_exe = try std.fs.openSelfExe(.{});
1212 defer self_exe.close();
13 var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
13 var buf: [std.fs.max_path_bytes]u8 = undefined;
1414 const self_exe_path = try std.os.getFdPath(self_exe.handle, &buf);
1515
1616 try std.testing.expectEqualStrings(self_exe_path, self_path);
test/standalone/windows_argv/fuzz.zig+2-2
......@@ -32,7 +32,7 @@ pub fn main() !void {
3232 }
3333 break :seed try std.fmt.parseUnsigned(u64, args[3], 10);
3434 };
35 var random = std.rand.DefaultPrng.init(seed);
35 var random = std.Random.DefaultPrng.init(seed);
3636 const rand = random.random();
3737
3838 // If the seed was not given via the CLI, then output the
......@@ -72,7 +72,7 @@ pub fn main() !void {
7272 }
7373}
7474
75fn randomCommandLineW(allocator: Allocator, rand: std.rand.Random) ![:0]const u16 {
75fn randomCommandLineW(allocator: Allocator, rand: std.Random) ![:0]const u16 {
7676 const Choice = enum {
7777 backslash,
7878 quote,
test/standalone/windows_bat_args/fuzz.zig+2-2
......@@ -27,7 +27,7 @@ pub fn main() anyerror!void {
2727 };
2828 break :seed try std.fmt.parseUnsigned(u64, seed_arg, 10);
2929 };
30 var random = std.rand.DefaultPrng.init(seed);
30 var random = std.Random.DefaultPrng.init(seed);
3131 const rand = random.random();
3232
3333 // If the seed was not given via the CLI, then output the
......@@ -109,7 +109,7 @@ fn testExecBat(allocator: std.mem.Allocator, bat: []const u8, args: []const []co
109109 }
110110}
111111
112fn randomArg(allocator: Allocator, rand: std.rand.Random) ![]const u8 {
112fn randomArg(allocator: Allocator, rand: std.Random) ![]const u8 {
113113 const Choice = enum {
114114 backslash,
115115 quote,