authorgravatar for mail@linusgroh.deLinus Groh <mail@linusgroh.de> 2025-10-15 17:30:06+02:00
committergravatar for mail@linusgroh.deLinus Groh <mail@linusgroh.de> 2025-11-27 20:17:04+00:00
log39fa8319478e4843d5384e81935520be2dbbadef
treeb49da0ca31477fc05aca2ef60bff82d7372f8bc2
parent8545836a4d8ab0ae1411b827c0fe1bcdcb268b72

std: Remove a handful of things deprecated during the 0.15 release cycle

- std.Build.Step.Compile.root_module mutators -> std.Build.Module - std.Build.Step.Compile.want_lto -> std.Build.Step.Compile.lto - std.Build.Step.ConfigHeader.getOutput -> std.Build.Step.ConfigHeader.getOutputFile - std.Build.Step.Run.max_stdio_size -> std.Build.Step.Run.stdio_limit - std.enums.nameCast -> @field(E, tag_name) / @field(E, @tagName(tag)) - std.Io.tty.detectConfig -> std.Io.tty.Config.detect - std.mem.trimLeft -> std.mem.trimStart - std.mem.trimRight -> std.mem.trimEnd - std.meta.intToEnum -> std.enums.fromInt - std.meta.TagPayload -> @FieldType(U, @tagName(tag)) - std.meta.TagPayloadByName -> @FieldType(U, tag_name)

21 files changed, 42 insertions(+), 280 deletions(-)

lib/compiler/aro/assembly_backend/x86_64.zig+2-2
......@@ -58,7 +58,7 @@ fn serializeFloat(comptime T: type, value: T, w: *std.Io.Writer) !void {
5858 },
5959 else => {
6060 const size = @bitSizeOf(T);
61 const storage_unit = std.meta.intToEnum(StorageUnit, size) catch unreachable;
61 const storage_unit = std.enums.fromInt(StorageUnit, size).?;
6262 const IntTy = @Int(.unsigned, size);
6363 const int_val: IntTy = @bitCast(value);
6464 return serializeInt(int_val, storage_unit, w);
......@@ -95,7 +95,7 @@ fn emitSingleValue(c: *AsmCodeGen, qt: QualType, node: Node.Index) !void {
9595 if (!scalar_kind.isReal()) {
9696 return c.todo("Codegen _Complex values", node.tok(c.tree));
9797 } else if (scalar_kind.isInt()) {
98 const storage_unit = std.meta.intToEnum(StorageUnit, bit_size) catch return c.todo("Codegen _BitInt values", node.tok(c.tree));
98 const storage_unit = std.enums.fromInt(StorageUnit, bit_size) orelse return c.todo("Codegen _BitInt values", node.tok(c.tree));
9999 try c.data.print(" .{s} ", .{@tagName(storage_unit)});
100100 _ = try value.print(qt, c.comp, c.data);
101101 try c.data.writeByte('\n');
lib/docs/wasm/markdown.zig+1-1
......@@ -149,7 +149,7 @@ fn mainImpl() !void {
149149 var stdin_reader = std.fs.File.stdin().reader(&stdin_buffer);
150150
151151 while (stdin_reader.takeDelimiterExclusive('\n')) |line| {
152 const trimmed = std.mem.trimRight(u8, line, '\r');
152 const trimmed = std.mem.trimEnd(u8, line, '\r');
153153 try parser.feedLine(trimmed);
154154 } else |err| switch (err) {
155155 error.EndOfStream => {},
lib/std/Build/Step/Compile.zig+2-135
......@@ -188,9 +188,6 @@ force_undefined_symbols: std.StringHashMap(void),
188188/// Overrides the default stack size
189189stack_size: ?u64 = null,
190190
191/// Deprecated; prefer using `lto`.
192want_lto: ?bool = null,
193
194191use_llvm: ?bool,
195192use_lld: ?bool,
196193use_new_linker: ?bool,
......@@ -540,7 +537,7 @@ pub fn installHeadersDirectory(
540537/// When a module links with this artifact, all headers marked for installation are added to that
541538/// module's include search path.
542539pub fn installConfigHeader(cs: *Compile, config_header: *Step.ConfigHeader) void {
543 cs.installHeader(config_header.getOutput(), config_header.include_path);
540 cs.installHeader(config_header.getOutputFile(), config_header.include_path);
544541}
545542
546543/// Forwards all headers marked for installation from `lib` to this artifact.
......@@ -683,18 +680,6 @@ pub fn producesImplib(compile: *Compile) bool {
683680 return compile.isDll();
684681}
685682
686/// Deprecated; use `compile.root_module.link_libc = true` instead.
687/// To be removed after 0.15.0 is tagged.
688pub fn linkLibC(compile: *Compile) void {
689 compile.root_module.link_libc = true;
690}
691
692/// Deprecated; use `compile.root_module.link_libcpp = true` instead.
693/// To be removed after 0.15.0 is tagged.
694pub fn linkLibCpp(compile: *Compile) void {
695 compile.root_module.link_libcpp = true;
696}
697
698683const PkgConfigResult = struct {
699684 cflags: []const []const u8,
700685 libs: []const []const u8,
......@@ -808,46 +793,6 @@ fn runPkgConfig(compile: *Compile, lib_name: []const u8) !PkgConfigResult {
808793 };
809794}
810795
811/// Deprecated; use `compile.root_module.linkSystemLibrary(name, .{})` instead.
812/// To be removed after 0.15.0 is tagged.
813pub fn linkSystemLibrary(compile: *Compile, name: []const u8) void {
814 return compile.root_module.linkSystemLibrary(name, .{});
815}
816
817/// Deprecated; use `compile.root_module.linkSystemLibrary(name, options)` instead.
818/// To be removed after 0.15.0 is tagged.
819pub fn linkSystemLibrary2(
820 compile: *Compile,
821 name: []const u8,
822 options: Module.LinkSystemLibraryOptions,
823) void {
824 return compile.root_module.linkSystemLibrary(name, options);
825}
826
827/// Deprecated; use `c.root_module.linkFramework(name, .{})` instead.
828/// To be removed after 0.15.0 is tagged.
829pub fn linkFramework(c: *Compile, name: []const u8) void {
830 c.root_module.linkFramework(name, .{});
831}
832
833/// Deprecated; use `compile.root_module.addCSourceFiles(options)` instead.
834/// To be removed after 0.15.0 is tagged.
835pub fn addCSourceFiles(compile: *Compile, options: Module.AddCSourceFilesOptions) void {
836 compile.root_module.addCSourceFiles(options);
837}
838
839/// Deprecated; use `compile.root_module.addCSourceFile(source)` instead.
840/// To be removed after 0.15.0 is tagged.
841pub fn addCSourceFile(compile: *Compile, source: Module.CSourceFile) void {
842 compile.root_module.addCSourceFile(source);
843}
844
845/// Deprecated; use `compile.root_module.addWin32ResourceFile(source)` instead.
846/// To be removed after 0.15.0 is tagged.
847pub fn addWin32ResourceFile(compile: *Compile, source: Module.RcSourceFile) void {
848 compile.root_module.addWin32ResourceFile(source);
849}
850
851796pub fn setVerboseLink(compile: *Compile, value: bool) void {
852797 compile.verbose_link = value;
853798}
......@@ -929,84 +874,6 @@ pub fn getEmittedLlvmBc(compile: *Compile) LazyPath {
929874 return compile.getEmittedFileGeneric(&compile.generated_llvm_bc);
930875}
931876
932/// Deprecated; use `compile.root_module.addAssemblyFile(source)` instead.
933/// To be removed after 0.15.0 is tagged.
934pub fn addAssemblyFile(compile: *Compile, source: LazyPath) void {
935 compile.root_module.addAssemblyFile(source);
936}
937
938/// Deprecated; use `compile.root_module.addObjectFile(source)` instead.
939/// To be removed after 0.15.0 is tagged.
940pub fn addObjectFile(compile: *Compile, source: LazyPath) void {
941 compile.root_module.addObjectFile(source);
942}
943
944/// Deprecated; use `compile.root_module.addObject(object)` instead.
945/// To be removed after 0.15.0 is tagged.
946pub fn addObject(compile: *Compile, object: *Compile) void {
947 compile.root_module.addObject(object);
948}
949
950/// Deprecated; use `compile.root_module.linkLibrary(library)` instead.
951/// To be removed after 0.15.0 is tagged.
952pub fn linkLibrary(compile: *Compile, library: *Compile) void {
953 compile.root_module.linkLibrary(library);
954}
955
956/// Deprecated; use `compile.root_module.addAfterIncludePath(lazy_path)` instead.
957/// To be removed after 0.15.0 is tagged.
958pub fn addAfterIncludePath(compile: *Compile, lazy_path: LazyPath) void {
959 compile.root_module.addAfterIncludePath(lazy_path);
960}
961
962/// Deprecated; use `compile.root_module.addSystemIncludePath(lazy_path)` instead.
963/// To be removed after 0.15.0 is tagged.
964pub fn addSystemIncludePath(compile: *Compile, lazy_path: LazyPath) void {
965 compile.root_module.addSystemIncludePath(lazy_path);
966}
967
968/// Deprecated; use `compile.root_module.addIncludePath(lazy_path)` instead.
969/// To be removed after 0.15.0 is tagged.
970pub fn addIncludePath(compile: *Compile, lazy_path: LazyPath) void {
971 compile.root_module.addIncludePath(lazy_path);
972}
973
974/// Deprecated; use `compile.root_module.addConfigHeader(config_header)` instead.
975/// To be removed after 0.15.0 is tagged.
976pub fn addConfigHeader(compile: *Compile, config_header: *Step.ConfigHeader) void {
977 compile.root_module.addConfigHeader(config_header);
978}
979
980/// Deprecated; use `compile.root_module.addEmbedPath(lazy_path)` instead.
981/// To be removed after 0.15.0 is tagged.
982pub fn addEmbedPath(compile: *Compile, lazy_path: LazyPath) void {
983 compile.root_module.addEmbedPath(lazy_path);
984}
985
986/// Deprecated; use `compile.root_module.addLibraryPath(directory_path)` instead.
987/// To be removed after 0.15.0 is tagged.
988pub fn addLibraryPath(compile: *Compile, directory_path: LazyPath) void {
989 compile.root_module.addLibraryPath(directory_path);
990}
991
992/// Deprecated; use `compile.root_module.addRPath(directory_path)` instead.
993/// To be removed after 0.15.0 is tagged.
994pub fn addRPath(compile: *Compile, directory_path: LazyPath) void {
995 compile.root_module.addRPath(directory_path);
996}
997
998/// Deprecated; use `compile.root_module.addSystemFrameworkPath(directory_path)` instead.
999/// To be removed after 0.15.0 is tagged.
1000pub fn addSystemFrameworkPath(compile: *Compile, directory_path: LazyPath) void {
1001 compile.root_module.addSystemFrameworkPath(directory_path);
1002}
1003
1004/// Deprecated; use `compile.root_module.addFrameworkPath(directory_path)` instead.
1005/// To be removed after 0.15.0 is tagged.
1006pub fn addFrameworkPath(compile: *Compile, directory_path: LazyPath) void {
1007 compile.root_module.addFrameworkPath(directory_path);
1008}
1009
1010877pub fn setExecCmd(compile: *Compile, args: []const ?[]const u8) void {
1011878 const b = compile.step.owner;
1012879 assert(compile.kind == .@"test");
......@@ -1763,7 +1630,7 @@ fn getZigArgs(compile: *Compile, fuzz: bool) ![][]const u8 {
17631630 .thin => "-flto=thin",
17641631 .none => "-fno-lto",
17651632 });
1766 } else try addFlag(&zig_args, "lto", compile.want_lto);
1633 }
17671634
17681635 try addFlag(&zig_args, "sanitize-coverage-trace-pc-guard", compile.sanitize_coverage_trace_pc_guard);
17691636
lib/std/Build/Step/ConfigHeader.zig-3
......@@ -124,9 +124,6 @@ pub fn getOutputFile(ch: *ConfigHeader) std.Build.LazyPath {
124124 return ch.getOutputDir().path(ch.step.owner, ch.include_path);
125125}
126126
127/// Deprecated; use `getOutputFile`.
128pub const getOutput = getOutputFile;
129
130127fn addValueInner(config_header: *ConfigHeader, name: []const u8, comptime T: type, value: T) !void {
131128 switch (@typeInfo(T)) {
132129 .null => {
lib/std/Build/Step/Run.zig-5
......@@ -88,9 +88,6 @@ skip_foreign_checks: bool,
8888/// external executor (such as qemu) but not fail if the executor is unavailable.
8989failing_to_execute_foreign_is_an_error: bool,
9090
91/// Deprecated in favor of `stdio_limit`.
92max_stdio_size: usize,
93
9491/// If stderr or stdout exceeds this amount, the child process is killed and
9592/// the step fails.
9693stdio_limit: std.Io.Limit,
......@@ -223,7 +220,6 @@ pub fn create(owner: *std.Build, name: []const u8) *Run {
223220 .rename_step_with_output_arg = true,
224221 .skip_foreign_checks = false,
225222 .failing_to_execute_foreign_is_an_error = true,
226 .max_stdio_size = 10 * 1024 * 1024,
227223 .stdio_limit = .unlimited,
228224 .captured_stdout = null,
229225 .captured_stderr = null,
......@@ -2217,7 +2213,6 @@ fn evalGeneric(run: *Run, child: *std.process.Child) !EvalGenericResult {
22172213 var stdout_bytes: ?[]const u8 = null;
22182214 var stderr_bytes: ?[]const u8 = null;
22192215
2220 run.stdio_limit = run.stdio_limit.min(.limited(run.max_stdio_size));
22212216 if (child.stdout) |stdout| {
22222217 if (child.stderr) |stderr| {
22232218 var poller = std.Io.poll(arena, enum { stdout, stderr }, .{
lib/std/Io/Reader.zig+1-1
......@@ -1252,7 +1252,7 @@ pub const TakeEnumError = Error || error{InvalidEnumTag};
12521252pub fn takeEnum(r: *Reader, comptime Enum: type, endian: std.builtin.Endian) TakeEnumError!Enum {
12531253 const Tag = @typeInfo(Enum).@"enum".tag_type;
12541254 const int = try r.takeInt(Tag, endian);
1255 return std.meta.intToEnum(Enum, int);
1255 return std.enums.fromInt(Enum, int) orelse return error.InvalidEnumTag;
12561256}
12571257
12581258/// Reads an integer with the same size as the given nonexhaustive enum's tag type.
lib/std/Io/Writer.zig+1-5
......@@ -1211,10 +1211,6 @@ pub fn printValue(
12111211 }
12121212
12131213 const is_any = comptime std.mem.eql(u8, fmt, ANY);
1214 if (!is_any and std.meta.hasMethod(T, "format") and fmt.len == 0) {
1215 // after 0.15.0 is tagged, delete this compile error and its condition
1216 @compileError("ambiguous format string; specify {f} to call format method, or {any} to skip it");
1217 }
12181214
12191215 switch (@typeInfo(T)) {
12201216 .float, .comptime_float => {
......@@ -1702,7 +1698,7 @@ pub fn printFloatHex(w: *Writer, value: anytype, case: std.fmt.Case, opt_precisi
17021698
17031699 try w.writeAll("0x");
17041700 try w.writeByte(buf[0]);
1705 const trimmed = std.mem.trimRight(u8, buf[1..], "0");
1701 const trimmed = std.mem.trimEnd(u8, buf[1..], "0");
17061702 if (opt_precision) |precision| {
17071703 if (precision > 0) try w.writeAll(".");
17081704 } else if (trimmed.len > 0) {
lib/std/Io/tty.zig-5
......@@ -5,11 +5,6 @@ const process = std.process;
55const windows = std.os.windows;
66const native_os = builtin.os.tag;
77
8/// Deprecated in favor of `Config.detect`.
9pub fn detectConfig(file: File) Config {
10 return .detect(file);
11}
12
138pub const Color = enum {
149 black,
1510 red,
lib/std/crypto/tls/Client.zig+1-1
......@@ -1158,7 +1158,7 @@ fn readIndirect(c: *Client) Reader.Error!usize {
11581158 P.AEAD.decrypt(cleartext, ciphertext, auth_tag, ad, nonce, pv.server_key) catch
11591159 return failRead(c, error.TlsBadRecordMac);
11601160 // TODO use scalar, non-slice version
1161 const msg = mem.trimRight(u8, cleartext, "\x00");
1161 const msg = mem.trimEnd(u8, cleartext, "\x00");
11621162 break :cleartext .{ msg.len - 1, @enumFromInt(msg[msg.len - 1]) };
11631163 },
11641164 .tls_1_2 => {
lib/std/debug.zig+4-4
......@@ -329,16 +329,16 @@ pub fn dumpHex(bytes: []const u8) void {
329329}
330330
331331/// Prints a hexadecimal view of the bytes, returning any error that occurs.
332pub fn dumpHexFallible(bw: *Writer, ttyconf: tty.Config, bytes: []const u8) !void {
332pub fn dumpHexFallible(bw: *Writer, tty_config: tty.Config, bytes: []const u8) !void {
333333 var chunks = mem.window(u8, bytes, 16, 16);
334334 while (chunks.next()) |window| {
335335 // 1. Print the address.
336336 const address = (@intFromPtr(bytes.ptr) + 0x10 * (std.math.divCeil(usize, chunks.index orelse bytes.len, 16) catch unreachable)) - 0x10;
337 try ttyconf.setColor(bw, .dim);
337 try tty_config.setColor(bw, .dim);
338338 // We print the address in lowercase and the bytes in uppercase hexadecimal to distinguish them more.
339339 // Also, make sure all lines are aligned by padding the address.
340340 try bw.print("{x:0>[1]} ", .{ address, @sizeOf(usize) * 2 });
341 try ttyconf.setColor(bw, .reset);
341 try tty_config.setColor(bw, .reset);
342342
343343 // 2. Print the bytes.
344344 for (window, 0..) |byte, index| {
......@@ -358,7 +358,7 @@ pub fn dumpHexFallible(bw: *Writer, ttyconf: tty.Config, bytes: []const u8) !voi
358358 try bw.writeByte(byte);
359359 } else {
360360 // Related: https://github.com/ziglang/zig/issues/7600
361 if (ttyconf == .windows_api) {
361 if (tty_config == .windows_api) {
362362 try bw.writeByte('.');
363363 continue;
364364 }
lib/std/enums.zig-42
......@@ -202,48 +202,6 @@ test "directEnumArrayDefault slice" {
202202 try testing.expectEqualSlices(u8, "default", array[2]);
203203}
204204
205/// Deprecated: Use @field(E, @tagName(tag)) or @field(E, string)
206pub fn nameCast(comptime E: type, comptime value: anytype) E {
207 return comptime blk: {
208 const V = @TypeOf(value);
209 if (V == E) break :blk value;
210 const name: ?[]const u8 = switch (@typeInfo(V)) {
211 .enum_literal, .@"enum" => @tagName(value),
212 .pointer => value,
213 else => null,
214 };
215 if (name) |n| {
216 if (@hasField(E, n)) {
217 break :blk @field(E, n);
218 }
219 @compileError("Enum " ++ @typeName(E) ++ " has no field named " ++ n);
220 }
221 @compileError("Cannot cast from " ++ @typeName(@TypeOf(value)) ++ " to " ++ @typeName(E));
222 };
223}
224
225test nameCast {
226 const A = enum(u1) { a = 0, b = 1 };
227 const B = enum(u1) { a = 1, b = 0 };
228 try testing.expectEqual(A.a, nameCast(A, .a));
229 try testing.expectEqual(A.a, nameCast(A, A.a));
230 try testing.expectEqual(A.a, nameCast(A, B.a));
231 try testing.expectEqual(A.a, nameCast(A, "a"));
232 try testing.expectEqual(A.a, nameCast(A, @as(*const [1]u8, "a")));
233 try testing.expectEqual(A.a, nameCast(A, @as([:0]const u8, "a")));
234 try testing.expectEqual(A.a, nameCast(A, @as([]const u8, "a")));
235
236 try testing.expectEqual(B.a, nameCast(B, .a));
237 try testing.expectEqual(B.a, nameCast(B, A.a));
238 try testing.expectEqual(B.a, nameCast(B, B.a));
239 try testing.expectEqual(B.a, nameCast(B, "a"));
240
241 try testing.expectEqual(B.b, nameCast(B, .b));
242 try testing.expectEqual(B.b, nameCast(B, A.b));
243 try testing.expectEqual(B.b, nameCast(B, B.b));
244 try testing.expectEqual(B.b, nameCast(B, "b"));
245}
246
247205test fromInt {
248206 const E1 = enum {
249207 A,
lib/std/heap/debug_allocator.zig+8-8
......@@ -460,7 +460,7 @@ pub fn DebugAllocator(comptime config: Config) type {
460460 pub fn detectLeaks(self: *Self) usize {
461461 var leaks: usize = 0;
462462
463 const tty_config = std.Io.tty.detectConfig(.stderr());
463 const tty_config: std.Io.tty.Config = .detect(.stderr());
464464
465465 for (self.buckets, 0..) |init_optional_bucket, size_class_index| {
466466 var optional_bucket = init_optional_bucket;
......@@ -536,7 +536,7 @@ pub fn DebugAllocator(comptime config: Config) type {
536536 fn reportDoubleFree(ret_addr: usize, alloc_stack_trace: StackTrace, free_stack_trace: StackTrace) void {
537537 var addr_buf: [stack_n]usize = undefined;
538538 const second_free_stack_trace = std.debug.captureCurrentStackTrace(.{ .first_address = ret_addr }, &addr_buf);
539 const tty_config = std.Io.tty.detectConfig(.stderr());
539 const tty_config: std.Io.tty.Config = .detect(.stderr());
540540 log.err("Double free detected. Allocation: {f} First free: {f} Second free: {f}", .{
541541 std.debug.FormatStackTrace{
542542 .stack_trace = alloc_stack_trace,
......@@ -590,7 +590,7 @@ pub fn DebugAllocator(comptime config: Config) type {
590590 if (config.safety and old_mem.len != entry.value_ptr.bytes.len) {
591591 var addr_buf: [stack_n]usize = undefined;
592592 const free_stack_trace = std.debug.captureCurrentStackTrace(.{ .first_address = ret_addr }, &addr_buf);
593 const tty_config = std.Io.tty.detectConfig(.stderr());
593 const tty_config: std.Io.tty.Config = .detect(.stderr());
594594 log.err("Allocation size {d} bytes does not match free size {d}. Allocation: {f} Free: {f}", .{
595595 entry.value_ptr.bytes.len,
596596 old_mem.len,
......@@ -703,7 +703,7 @@ pub fn DebugAllocator(comptime config: Config) type {
703703 if (config.safety and old_mem.len != entry.value_ptr.bytes.len) {
704704 var addr_buf: [stack_n]usize = undefined;
705705 const free_stack_trace = std.debug.captureCurrentStackTrace(.{ .first_address = ret_addr }, &addr_buf);
706 const tty_config = std.Io.tty.detectConfig(.stderr());
706 const tty_config: std.Io.tty.Config = .detect(.stderr());
707707 log.err("Allocation size {d} bytes does not match free size {d}. Allocation: {f} Free: {f}", .{
708708 entry.value_ptr.bytes.len,
709709 old_mem.len,
......@@ -935,7 +935,7 @@ pub fn DebugAllocator(comptime config: Config) type {
935935 var addr_buf: [stack_n]usize = undefined;
936936 const free_stack_trace = std.debug.captureCurrentStackTrace(.{ .first_address = return_address }, &addr_buf);
937937 if (old_memory.len != requested_size) {
938 const tty_config = std.Io.tty.detectConfig(.stderr());
938 const tty_config: std.Io.tty.Config = .detect(.stderr());
939939 log.err("Allocation size {d} bytes does not match free size {d}. Allocation: {f} Free: {f}", .{
940940 requested_size,
941941 old_memory.len,
......@@ -950,7 +950,7 @@ pub fn DebugAllocator(comptime config: Config) type {
950950 });
951951 }
952952 if (alignment != slot_alignment) {
953 const tty_config = std.Io.tty.detectConfig(.stderr());
953 const tty_config: std.Io.tty.Config = .detect(.stderr());
954954 log.err("Allocation alignment {d} does not match free alignment {d}. Allocation: {f} Free: {f}", .{
955955 slot_alignment.toByteUnits(),
956956 alignment.toByteUnits(),
......@@ -1044,7 +1044,7 @@ pub fn DebugAllocator(comptime config: Config) type {
10441044 var addr_buf: [stack_n]usize = undefined;
10451045 const free_stack_trace = std.debug.captureCurrentStackTrace(.{ .first_address = return_address }, &addr_buf);
10461046 if (memory.len != requested_size) {
1047 const tty_config = std.Io.tty.detectConfig(.stderr());
1047 const tty_config: std.Io.tty.Config = .detect(.stderr());
10481048 log.err("Allocation size {d} bytes does not match free size {d}. Allocation: {f} Free: {f}", .{
10491049 requested_size,
10501050 memory.len,
......@@ -1059,7 +1059,7 @@ pub fn DebugAllocator(comptime config: Config) type {
10591059 });
10601060 }
10611061 if (alignment != slot_alignment) {
1062 const tty_config = std.Io.tty.detectConfig(.stderr());
1062 const tty_config: std.Io.tty.Config = .detect(.stderr());
10631063 log.err("Allocation alignment {d} does not match free alignment {d}. Allocation: {f} Free: {f}", .{
10641064 slot_alignment.toByteUnits(),
10651065 alignment.toByteUnits(),
lib/std/http/Client.zig+1-1
......@@ -529,7 +529,7 @@ pub const Response = struct {
529529 };
530530 if (first_line[8] != ' ') return error.HttpHeadersInvalid;
531531 const status: http.Status = @enumFromInt(parseInt3(first_line[9..12]));
532 const reason = mem.trimLeft(u8, first_line[12..], " ");
532 const reason = mem.trimStart(u8, first_line[12..], " ");
533533
534534 res.version = version;
535535 res.status = status;
lib/std/mem.zig-6
......@@ -1221,9 +1221,6 @@ test trimStart {
12211221 try testing.expectEqualSlices(u8, "foo\n ", trimStart(u8, " foo\n ", " \n"));
12221222}
12231223
1224/// Deprecated: use `trimStart` instead.
1225pub const trimLeft = trimStart;
1226
12271224/// Remove a set of values from the end of a slice.
12281225pub fn trimEnd(comptime T: type, slice: []const T, values_to_strip: []const T) []const T {
12291226 var end: usize = slice.len;
......@@ -1235,9 +1232,6 @@ test trimEnd {
12351232 try testing.expectEqualSlices(u8, " foo", trimEnd(u8, " foo\n ", " \n"));
12361233}
12371234
1238/// Deprecated: use `trimEnd` instead.
1239pub const trimRight = trimEnd;
1240
12411235/// Remove a set of values from the beginning and end of a slice.
12421236pub fn trim(comptime T: type, slice: []const T, values_to_strip: []const T) []const T {
12431237 var begin: usize = 0;
lib/std/meta.zig-40
......@@ -614,38 +614,6 @@ test activeTag {
614614 try testing.expect(activeTag(u) == UE.Float);
615615}
616616
617/// Deprecated: Use @FieldType(U, tag_name)
618const TagPayloadType = TagPayload;
619
620/// Deprecated: Use @FieldType(U, tag_name)
621pub fn TagPayloadByName(comptime U: type, comptime tag_name: []const u8) type {
622 const info = @typeInfo(U).@"union";
623
624 inline for (info.fields) |field_info| {
625 if (comptime mem.eql(u8, field_info.name, tag_name))
626 return field_info.type;
627 }
628
629 @compileError("no field '" ++ tag_name ++ "' in union '" ++ @typeName(U) ++ "'");
630}
631
632/// Deprecated: Use @FieldType(U, @tagName(tag))
633pub fn TagPayload(comptime U: type, comptime tag: Tag(U)) type {
634 return TagPayloadByName(U, @tagName(tag));
635}
636
637test TagPayload {
638 const Event = union(enum) {
639 Moved: struct {
640 from: i32,
641 to: i32,
642 },
643 };
644 const MovedEvent = TagPayload(Event, Event.Moved);
645 const e: Event = .{ .Moved = undefined };
646 try testing.expect(MovedEvent == @TypeOf(e.Moved));
647}
648
649617/// Compares two of any type for equality. Containers that do not support comparison
650618/// on their own are compared on a field-by-field basis. Pointers are not followed.
651619pub fn eql(a: anytype, b: @TypeOf(a)) bool {
......@@ -774,14 +742,6 @@ test eql {
774742 try testing.expect(!eql(v1, v3));
775743}
776744
777/// Deprecated: use `std.enums.fromInt` instead and handle null.
778pub const IntToEnumError = error{InvalidEnumTag};
779
780/// Deprecated: use `std.enums.fromInt` instead and handle null instead of an error.
781pub fn intToEnum(comptime EnumTag: type, tag_int: anytype) IntToEnumError!EnumTag {
782 return std.enums.fromInt(EnumTag, tag_int) orelse return error.InvalidEnumTag;
783}
784
785745/// Given a type and a name, return the field index according to source order.
786746/// Returns `null` if the field is not found.
787747pub fn fieldIndex(comptime T: type, comptime name: []const u8) ?comptime_int {
lib/std/os/linux/test.zig+7-7
......@@ -138,23 +138,23 @@ test "sigset_t" {
138138 // See that none are set, then set each one, see that they're all set, then
139139 // remove them all, and then see that none are set.
140140 for (1..linux.NSIG) |i| {
141 const sig = std.meta.intToEnum(SIG, i) catch continue;
141 const sig = std.enums.fromInt(SIG, i) orelse continue;
142142 try expectEqual(false, linux.sigismember(&sigset, sig));
143143 }
144144 for (1..linux.NSIG) |i| {
145 const sig = std.meta.intToEnum(SIG, i) catch continue;
145 const sig = std.enums.fromInt(SIG, i) orelse continue;
146146 linux.sigaddset(&sigset, sig);
147147 }
148148 for (1..linux.NSIG) |i| {
149 const sig = std.meta.intToEnum(SIG, i) catch continue;
149 const sig = std.enums.fromInt(SIG, i) orelse continue;
150150 try expectEqual(true, linux.sigismember(&sigset, sig));
151151 }
152152 for (1..linux.NSIG) |i| {
153 const sig = std.meta.intToEnum(SIG, i) catch continue;
153 const sig = std.enums.fromInt(SIG, i) orelse continue;
154154 linux.sigdelset(&sigset, sig);
155155 }
156156 for (1..linux.NSIG) |i| {
157 const sig = std.meta.intToEnum(SIG, i) catch continue;
157 const sig = std.enums.fromInt(SIG, i) orelse continue;
158158 try expectEqual(false, linux.sigismember(&sigset, sig));
159159 }
160160}
......@@ -163,7 +163,7 @@ test "sigfillset" {
163163 // unlike the C library, all the signals are set in the kernel-level fillset
164164 const sigset = linux.sigfillset();
165165 for (1..linux.NSIG) |i| {
166 const sig = std.meta.intToEnum(linux.SIG, i) catch continue;
166 const sig = std.enums.fromInt(linux.SIG, i) orelse continue;
167167 try expectEqual(true, linux.sigismember(&sigset, sig));
168168 }
169169}
......@@ -171,7 +171,7 @@ test "sigfillset" {
171171test "sigemptyset" {
172172 const sigset = linux.sigemptyset();
173173 for (1..linux.NSIG) |i| {
174 const sig = std.meta.intToEnum(linux.SIG, i) catch continue;
174 const sig = std.enums.fromInt(linux.SIG, i) orelse continue;
175175 try expectEqual(false, linux.sigismember(&sigset, sig));
176176 }
177177}
lib/std/os/uefi/protocol/ip6_config.zig+3-3
......@@ -44,7 +44,7 @@ pub const Ip6Config = extern struct {
4444 pub fn setData(
4545 self: *const Ip6Config,
4646 comptime data_type: std.meta.Tag(DataType),
47 payload: *const std.meta.TagPayload(DataType, data_type),
47 payload: *const @FieldType(DataType, @tagName(data_type)),
4848 ) SetDataError!void {
4949 const data_size = @sizeOf(@TypeOf(payload));
5050 switch (self._set_data(self, data_type, data_size, @ptrCast(payload))) {
......@@ -64,8 +64,8 @@ pub const Ip6Config = extern struct {
6464 pub fn getData(
6565 self: *const Ip6Config,
6666 comptime data_type: std.meta.Tag(DataType),
67 ) GetDataError!std.meta.TagPayload(DataType, data_type) {
68 const DataPayload = std.meta.TagPayload(DataType, data_type);
67 ) GetDataError!@FieldType(DataType, @tagName(data_type)) {
68 const DataPayload = @FieldType(DataType, @tagName(data_type));
6969
7070 var payload: DataPayload = undefined;
7171 var payload_size: usize = @sizeOf(DataPayload);
lib/std/posix/test.zig+6-6
......@@ -536,7 +536,7 @@ test "sigset empty/full" {
536536
537537 var set: posix.sigset_t = posix.sigemptyset();
538538 for (1..posix.NSIG) |i| {
539 const sig = std.meta.intToEnum(posix.SIG, i) catch continue;
539 const sig = std.enums.fromInt(posix.SIG, i) orelse continue;
540540 try expectEqual(false, posix.sigismember(&set, sig));
541541 }
542542
......@@ -565,29 +565,29 @@ test "sigset add/del" {
565565 // See that none are set, then set each one, see that they're all set, then
566566 // remove them all, and then see that none are set.
567567 for (1..posix.NSIG) |i| {
568 const sig = std.meta.intToEnum(posix.SIG, i) catch continue;
568 const sig = std.enums.fromInt(posix.SIG, i) orelse continue;
569569 try expectEqual(false, posix.sigismember(&sigset, sig));
570570 }
571571 for (1..posix.NSIG) |i| {
572572 if (!reserved_signo(i)) {
573 const sig = std.meta.intToEnum(posix.SIG, i) catch continue;
573 const sig = std.enums.fromInt(posix.SIG, i) orelse continue;
574574 posix.sigaddset(&sigset, sig);
575575 }
576576 }
577577 for (1..posix.NSIG) |i| {
578578 if (!reserved_signo(i)) {
579 const sig = std.meta.intToEnum(posix.SIG, i) catch continue;
579 const sig = std.enums.fromInt(posix.SIG, i) orelse continue;
580580 try expectEqual(true, posix.sigismember(&sigset, sig));
581581 }
582582 }
583583 for (1..posix.NSIG) |i| {
584584 if (!reserved_signo(i)) {
585 const sig = std.meta.intToEnum(posix.SIG, i) catch continue;
585 const sig = std.enums.fromInt(posix.SIG, i) orelse continue;
586586 posix.sigdelset(&sigset, sig);
587587 }
588588 }
589589 for (1..posix.NSIG) |i| {
590 const sig = std.meta.intToEnum(posix.SIG, i) catch continue;
590 const sig = std.enums.fromInt(posix.SIG, i) orelse continue;
591591 try expectEqual(false, posix.sigismember(&sigset, sig));
592592 }
593593}
lib/std/testing.zig+1-1
......@@ -1160,7 +1160,7 @@ pub fn checkAllAllocationFailures(backing_allocator: std.mem.Allocator, comptime
11601160 } else |err| switch (err) {
11611161 error.OutOfMemory => {
11621162 if (failing_allocator_inst.allocated_bytes != failing_allocator_inst.freed_bytes) {
1163 const tty_config = std.Io.tty.detectConfig(.stderr());
1163 const tty_config: std.Io.tty.Config = .detect(.stderr());
11641164 print(
11651165 "\nfail_index: {d}/{d}\nallocated bytes: {d}\nfreed bytes: {d}\nallocations: {d}\ndeallocations: {d}\nallocation that was made to fail: {f}",
11661166 .{
test/standalone/config_header/build.zig+1-1
......@@ -21,7 +21,7 @@ pub fn build(b: *std.Build) void {
2121 },
2222 );
2323
24 const check_config_header = b.addCheckFile(config_header.getOutput(), .{ .expected_exact = @embedFile("config.h") });
24 const check_config_header = b.addCheckFile(config_header.getOutputFile(), .{ .expected_exact = @embedFile("config.h") });
2525
2626 const test_step = b.step("test", "Test it");
2727 test_step.dependOn(&check_config_header.step);
test/standalone/test_obj_link_run/build.zig+3-3
......@@ -9,9 +9,9 @@ pub fn build(b: *std.Build) void {
99 }),
1010 });
1111 if (is_windows) {
12 test_obj.linkSystemLibrary("ntdll");
13 test_obj.linkSystemLibrary("kernel32");
14 test_obj.linkSystemLibrary("ws2_32");
12 test_obj.root_module.linkSystemLibrary("ntdll", .{});
13 test_obj.root_module.linkSystemLibrary("kernel32", .{});
14 test_obj.root_module.linkSystemLibrary("ws2_32", .{});
1515 }
1616
1717 const test_exe_mod = b.createModule(.{