| author | |
| committer | |
| log | 39fa8319478e4843d5384e81935520be2dbbadef |
| tree | b49da0ca31477fc05aca2ef60bff82d7372f8bc2 |
| parent | 8545836a4d8ab0ae1411b827c0fe1bcdcb268b72 |
- 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 { | ... | @@ -58,7 +58,7 @@ fn serializeFloat(comptime T: type, value: T, w: *std.Io.Writer) !void { |
| 58 | }, | 58 | }, |
| 59 | else => { | 59 | else => { |
| 60 | const size = @bitSizeOf(T); | 60 | const size = @bitSizeOf(T); |
| 61 | const storage_unit = std.meta.intToEnum(StorageUnit, size) catch unreachable; | 61 | const storage_unit = std.enums.fromInt(StorageUnit, size).?; |
| 62 | const IntTy = @Int(.unsigned, size); | 62 | const IntTy = @Int(.unsigned, size); |
| 63 | const int_val: IntTy = @bitCast(value); | 63 | const int_val: IntTy = @bitCast(value); |
| 64 | return serializeInt(int_val, storage_unit, w); | 64 | return serializeInt(int_val, storage_unit, w); |
| ... | @@ -95,7 +95,7 @@ fn emitSingleValue(c: *AsmCodeGen, qt: QualType, node: Node.Index) !void { | ... | @@ -95,7 +95,7 @@ fn emitSingleValue(c: *AsmCodeGen, qt: QualType, node: Node.Index) !void { |
| 95 | if (!scalar_kind.isReal()) { | 95 | if (!scalar_kind.isReal()) { |
| 96 | return c.todo("Codegen _Complex values", node.tok(c.tree)); | 96 | return c.todo("Codegen _Complex values", node.tok(c.tree)); |
| 97 | } else if (scalar_kind.isInt()) { | 97 | } 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)); |
| 99 | try c.data.print(" .{s} ", .{@tagName(storage_unit)}); | 99 | try c.data.print(" .{s} ", .{@tagName(storage_unit)}); |
| 100 | _ = try value.print(qt, c.comp, c.data); | 100 | _ = try value.print(qt, c.comp, c.data); |
| 101 | try c.data.writeByte('\n'); | 101 | try c.data.writeByte('\n'); |
lib/docs/wasm/markdown.zig+1-1| ... | @@ -149,7 +149,7 @@ fn mainImpl() !void { | ... | @@ -149,7 +149,7 @@ fn mainImpl() !void { |
| 149 | var stdin_reader = std.fs.File.stdin().reader(&stdin_buffer); | 149 | var stdin_reader = std.fs.File.stdin().reader(&stdin_buffer); |
| 150 | 150 | ||
| 151 | while (stdin_reader.takeDelimiterExclusive('\n')) |line| { | 151 | while (stdin_reader.takeDelimiterExclusive('\n')) |line| { |
| 152 | const trimmed = std.mem.trimRight(u8, line, '\r'); | 152 | const trimmed = std.mem.trimEnd(u8, line, '\r'); |
| 153 | try parser.feedLine(trimmed); | 153 | try parser.feedLine(trimmed); |
| 154 | } else |err| switch (err) { | 154 | } else |err| switch (err) { |
| 155 | error.EndOfStream => {}, | 155 | error.EndOfStream => {}, |
lib/std/Build/Step/Compile.zig+2-135| ... | @@ -188,9 +188,6 @@ force_undefined_symbols: std.StringHashMap(void), | ... | @@ -188,9 +188,6 @@ force_undefined_symbols: std.StringHashMap(void), |
| 188 | /// Overrides the default stack size | 188 | /// Overrides the default stack size |
| 189 | stack_size: ?u64 = null, | 189 | stack_size: ?u64 = null, |
| 190 | 190 | ||
| 191 | /// Deprecated; prefer using `lto`. | ||
| 192 | want_lto: ?bool = null, | ||
| 193 | |||
| 194 | use_llvm: ?bool, | 191 | use_llvm: ?bool, |
| 195 | use_lld: ?bool, | 192 | use_lld: ?bool, |
| 196 | use_new_linker: ?bool, | 193 | use_new_linker: ?bool, |
| ... | @@ -540,7 +537,7 @@ pub fn installHeadersDirectory( | ... | @@ -540,7 +537,7 @@ pub fn installHeadersDirectory( |
| 540 | /// When a module links with this artifact, all headers marked for installation are added to that | 537 | /// When a module links with this artifact, all headers marked for installation are added to that |
| 541 | /// module's include search path. | 538 | /// module's include search path. |
| 542 | pub fn installConfigHeader(cs: *Compile, config_header: *Step.ConfigHeader) void { | 539 | pub 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); |
| 544 | } | 541 | } |
| 545 | 542 | ||
| 546 | /// Forwards all headers marked for installation from `lib` to this artifact. | 543 | /// Forwards all headers marked for installation from `lib` to this artifact. |
| ... | @@ -683,18 +680,6 @@ pub fn producesImplib(compile: *Compile) bool { | ... | @@ -683,18 +680,6 @@ pub fn producesImplib(compile: *Compile) bool { |
| 683 | return compile.isDll(); | 680 | return compile.isDll(); |
| 684 | } | 681 | } |
| 685 | 682 | ||
| 686 | /// Deprecated; use `compile.root_module.link_libc = true` instead. | ||
| 687 | /// To be removed after 0.15.0 is tagged. | ||
| 688 | pub 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. | ||
| 694 | pub fn linkLibCpp(compile: *Compile) void { | ||
| 695 | compile.root_module.link_libcpp = true; | ||
| 696 | } | ||
| 697 | |||
| 698 | const PkgConfigResult = struct { | 683 | const PkgConfigResult = struct { |
| 699 | cflags: []const []const u8, | 684 | cflags: []const []const u8, |
| 700 | libs: []const []const u8, | 685 | libs: []const []const u8, |
| ... | @@ -808,46 +793,6 @@ fn runPkgConfig(compile: *Compile, lib_name: []const u8) !PkgConfigResult { | ... | @@ -808,46 +793,6 @@ fn runPkgConfig(compile: *Compile, lib_name: []const u8) !PkgConfigResult { |
| 808 | }; | 793 | }; |
| 809 | } | 794 | } |
| 810 | 795 | ||
| 811 | /// Deprecated; use `compile.root_module.linkSystemLibrary(name, .{})` instead. | ||
| 812 | /// To be removed after 0.15.0 is tagged. | ||
| 813 | pub 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. | ||
| 819 | pub 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. | ||
| 829 | pub 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. | ||
| 835 | pub 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. | ||
| 841 | pub 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. | ||
| 847 | pub fn addWin32ResourceFile(compile: *Compile, source: Module.RcSourceFile) void { | ||
| 848 | compile.root_module.addWin32ResourceFile(source); | ||
| 849 | } | ||
| 850 | |||
| 851 | pub fn setVerboseLink(compile: *Compile, value: bool) void { | 796 | pub fn setVerboseLink(compile: *Compile, value: bool) void { |
| 852 | compile.verbose_link = value; | 797 | compile.verbose_link = value; |
| 853 | } | 798 | } |
| ... | @@ -929,84 +874,6 @@ pub fn getEmittedLlvmBc(compile: *Compile) LazyPath { | ... | @@ -929,84 +874,6 @@ pub fn getEmittedLlvmBc(compile: *Compile) LazyPath { |
| 929 | return compile.getEmittedFileGeneric(&compile.generated_llvm_bc); | 874 | return compile.getEmittedFileGeneric(&compile.generated_llvm_bc); |
| 930 | } | 875 | } |
| 931 | 876 | ||
| 932 | /// Deprecated; use `compile.root_module.addAssemblyFile(source)` instead. | ||
| 933 | /// To be removed after 0.15.0 is tagged. | ||
| 934 | pub 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. | ||
| 940 | pub 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. | ||
| 946 | pub 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. | ||
| 952 | pub 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. | ||
| 958 | pub 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. | ||
| 964 | pub 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. | ||
| 970 | pub 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. | ||
| 976 | pub 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. | ||
| 982 | pub 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. | ||
| 988 | pub 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. | ||
| 994 | pub 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. | ||
| 1000 | pub 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. | ||
| 1006 | pub fn addFrameworkPath(compile: *Compile, directory_path: LazyPath) void { | ||
| 1007 | compile.root_module.addFrameworkPath(directory_path); | ||
| 1008 | } | ||
| 1009 | |||
| 1010 | pub fn setExecCmd(compile: *Compile, args: []const ?[]const u8) void { | 877 | pub fn setExecCmd(compile: *Compile, args: []const ?[]const u8) void { |
| 1011 | const b = compile.step.owner; | 878 | const b = compile.step.owner; |
| 1012 | assert(compile.kind == .@"test"); | 879 | assert(compile.kind == .@"test"); |
| ... | @@ -1763,7 +1630,7 @@ fn getZigArgs(compile: *Compile, fuzz: bool) ![][]const u8 { | ... | @@ -1763,7 +1630,7 @@ fn getZigArgs(compile: *Compile, fuzz: bool) ![][]const u8 { |
| 1763 | .thin => "-flto=thin", | 1630 | .thin => "-flto=thin", |
| 1764 | .none => "-fno-lto", | 1631 | .none => "-fno-lto", |
| 1765 | }); | 1632 | }); |
| 1766 | } else try addFlag(&zig_args, "lto", compile.want_lto); | 1633 | } |
| 1767 | 1634 | ||
| 1768 | try addFlag(&zig_args, "sanitize-coverage-trace-pc-guard", compile.sanitize_coverage_trace_pc_guard); | 1635 | try addFlag(&zig_args, "sanitize-coverage-trace-pc-guard", compile.sanitize_coverage_trace_pc_guard); |
| 1769 | 1636 |
lib/std/Build/Step/ConfigHeader.zig-3| ... | @@ -124,9 +124,6 @@ pub fn getOutputFile(ch: *ConfigHeader) std.Build.LazyPath { | ... | @@ -124,9 +124,6 @@ pub fn getOutputFile(ch: *ConfigHeader) std.Build.LazyPath { |
| 124 | return ch.getOutputDir().path(ch.step.owner, ch.include_path); | 124 | return ch.getOutputDir().path(ch.step.owner, ch.include_path); |
| 125 | } | 125 | } |
| 126 | 126 | ||
| 127 | /// Deprecated; use `getOutputFile`. | ||
| 128 | pub const getOutput = getOutputFile; | ||
| 129 | |||
| 130 | fn addValueInner(config_header: *ConfigHeader, name: []const u8, comptime T: type, value: T) !void { | 127 | fn addValueInner(config_header: *ConfigHeader, name: []const u8, comptime T: type, value: T) !void { |
| 131 | switch (@typeInfo(T)) { | 128 | switch (@typeInfo(T)) { |
| 132 | .null => { | 129 | .null => { |
lib/std/Build/Step/Run.zig-5| ... | @@ -88,9 +88,6 @@ skip_foreign_checks: bool, | ... | @@ -88,9 +88,6 @@ skip_foreign_checks: bool, |
| 88 | /// external executor (such as qemu) but not fail if the executor is unavailable. | 88 | /// external executor (such as qemu) but not fail if the executor is unavailable. |
| 89 | failing_to_execute_foreign_is_an_error: bool, | 89 | failing_to_execute_foreign_is_an_error: bool, |
| 90 | 90 | ||
| 91 | /// Deprecated in favor of `stdio_limit`. | ||
| 92 | max_stdio_size: usize, | ||
| 93 | |||
| 94 | /// If stderr or stdout exceeds this amount, the child process is killed and | 91 | /// If stderr or stdout exceeds this amount, the child process is killed and |
| 95 | /// the step fails. | 92 | /// the step fails. |
| 96 | stdio_limit: std.Io.Limit, | 93 | stdio_limit: std.Io.Limit, |
| ... | @@ -223,7 +220,6 @@ pub fn create(owner: *std.Build, name: []const u8) *Run { | ... | @@ -223,7 +220,6 @@ pub fn create(owner: *std.Build, name: []const u8) *Run { |
| 223 | .rename_step_with_output_arg = true, | 220 | .rename_step_with_output_arg = true, |
| 224 | .skip_foreign_checks = false, | 221 | .skip_foreign_checks = false, |
| 225 | .failing_to_execute_foreign_is_an_error = true, | 222 | .failing_to_execute_foreign_is_an_error = true, |
| 226 | .max_stdio_size = 10 * 1024 * 1024, | ||
| 227 | .stdio_limit = .unlimited, | 223 | .stdio_limit = .unlimited, |
| 228 | .captured_stdout = null, | 224 | .captured_stdout = null, |
| 229 | .captured_stderr = null, | 225 | .captured_stderr = null, |
| ... | @@ -2217,7 +2213,6 @@ fn evalGeneric(run: *Run, child: *std.process.Child) !EvalGenericResult { | ... | @@ -2217,7 +2213,6 @@ fn evalGeneric(run: *Run, child: *std.process.Child) !EvalGenericResult { |
| 2217 | var stdout_bytes: ?[]const u8 = null; | 2213 | var stdout_bytes: ?[]const u8 = null; |
| 2218 | var stderr_bytes: ?[]const u8 = null; | 2214 | var stderr_bytes: ?[]const u8 = null; |
| 2219 | 2215 | ||
| 2220 | run.stdio_limit = run.stdio_limit.min(.limited(run.max_stdio_size)); | ||
| 2221 | if (child.stdout) |stdout| { | 2216 | if (child.stdout) |stdout| { |
| 2222 | if (child.stderr) |stderr| { | 2217 | if (child.stderr) |stderr| { |
| 2223 | var poller = std.Io.poll(arena, enum { stdout, stderr }, .{ | 2218 | 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}; | ... | @@ -1252,7 +1252,7 @@ pub const TakeEnumError = Error || error{InvalidEnumTag}; |
| 1252 | pub fn takeEnum(r: *Reader, comptime Enum: type, endian: std.builtin.Endian) TakeEnumError!Enum { | 1252 | pub fn takeEnum(r: *Reader, comptime Enum: type, endian: std.builtin.Endian) TakeEnumError!Enum { |
| 1253 | const Tag = @typeInfo(Enum).@"enum".tag_type; | 1253 | const Tag = @typeInfo(Enum).@"enum".tag_type; |
| 1254 | const int = try r.takeInt(Tag, endian); | 1254 | 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; |
| 1256 | } | 1256 | } |
| 1257 | 1257 | ||
| 1258 | /// Reads an integer with the same size as the given nonexhaustive enum's tag type. | 1258 | /// 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( | ... | @@ -1211,10 +1211,6 @@ pub fn printValue( |
| 1211 | } | 1211 | } |
| 1212 | 1212 | ||
| 1213 | const is_any = comptime std.mem.eql(u8, fmt, ANY); | 1213 | 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 | } | ||
| 1218 | 1214 | ||
| 1219 | switch (@typeInfo(T)) { | 1215 | switch (@typeInfo(T)) { |
| 1220 | .float, .comptime_float => { | 1216 | .float, .comptime_float => { |
| ... | @@ -1702,7 +1698,7 @@ pub fn printFloatHex(w: *Writer, value: anytype, case: std.fmt.Case, opt_precisi | ... | @@ -1702,7 +1698,7 @@ pub fn printFloatHex(w: *Writer, value: anytype, case: std.fmt.Case, opt_precisi |
| 1702 | 1698 | ||
| 1703 | try w.writeAll("0x"); | 1699 | try w.writeAll("0x"); |
| 1704 | try w.writeByte(buf[0]); | 1700 | 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"); |
| 1706 | if (opt_precision) |precision| { | 1702 | if (opt_precision) |precision| { |
| 1707 | if (precision > 0) try w.writeAll("."); | 1703 | if (precision > 0) try w.writeAll("."); |
| 1708 | } else if (trimmed.len > 0) { | 1704 | } else if (trimmed.len > 0) { |
lib/std/Io/tty.zig-5| ... | @@ -5,11 +5,6 @@ const process = std.process; | ... | @@ -5,11 +5,6 @@ const process = std.process; |
| 5 | const windows = std.os.windows; | 5 | const windows = std.os.windows; |
| 6 | const native_os = builtin.os.tag; | 6 | const native_os = builtin.os.tag; |
| 7 | 7 | ||
| 8 | /// Deprecated in favor of `Config.detect`. | ||
| 9 | pub fn detectConfig(file: File) Config { | ||
| 10 | return .detect(file); | ||
| 11 | } | ||
| 12 | |||
| 13 | pub const Color = enum { | 8 | pub const Color = enum { |
| 14 | black, | 9 | black, |
| 15 | red, | 10 | red, |
lib/std/crypto/tls/Client.zig+1-1| ... | @@ -1158,7 +1158,7 @@ fn readIndirect(c: *Client) Reader.Error!usize { | ... | @@ -1158,7 +1158,7 @@ fn readIndirect(c: *Client) Reader.Error!usize { |
| 1158 | P.AEAD.decrypt(cleartext, ciphertext, auth_tag, ad, nonce, pv.server_key) catch | 1158 | P.AEAD.decrypt(cleartext, ciphertext, auth_tag, ad, nonce, pv.server_key) catch |
| 1159 | return failRead(c, error.TlsBadRecordMac); | 1159 | return failRead(c, error.TlsBadRecordMac); |
| 1160 | // TODO use scalar, non-slice version | 1160 | // TODO use scalar, non-slice version |
| 1161 | const msg = mem.trimRight(u8, cleartext, "\x00"); | 1161 | const msg = mem.trimEnd(u8, cleartext, "\x00"); |
| 1162 | break :cleartext .{ msg.len - 1, @enumFromInt(msg[msg.len - 1]) }; | 1162 | break :cleartext .{ msg.len - 1, @enumFromInt(msg[msg.len - 1]) }; |
| 1163 | }, | 1163 | }, |
| 1164 | .tls_1_2 => { | 1164 | .tls_1_2 => { |
lib/std/debug.zig+4-4| ... | @@ -329,16 +329,16 @@ pub fn dumpHex(bytes: []const u8) void { | ... | @@ -329,16 +329,16 @@ pub fn dumpHex(bytes: []const u8) void { |
| 329 | } | 329 | } |
| 330 | 330 | ||
| 331 | /// Prints a hexadecimal view of the bytes, returning any error that occurs. | 331 | /// Prints a hexadecimal view of the bytes, returning any error that occurs. |
| 332 | pub fn dumpHexFallible(bw: *Writer, ttyconf: tty.Config, bytes: []const u8) !void { | 332 | pub fn dumpHexFallible(bw: *Writer, tty_config: tty.Config, bytes: []const u8) !void { |
| 333 | var chunks = mem.window(u8, bytes, 16, 16); | 333 | var chunks = mem.window(u8, bytes, 16, 16); |
| 334 | while (chunks.next()) |window| { | 334 | while (chunks.next()) |window| { |
| 335 | // 1. Print the address. | 335 | // 1. Print the address. |
| 336 | const address = (@intFromPtr(bytes.ptr) + 0x10 * (std.math.divCeil(usize, chunks.index orelse bytes.len, 16) catch unreachable)) - 0x10; | 336 | 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); |
| 338 | // We print the address in lowercase and the bytes in uppercase hexadecimal to distinguish them more. | 338 | // We print the address in lowercase and the bytes in uppercase hexadecimal to distinguish them more. |
| 339 | // Also, make sure all lines are aligned by padding the address. | 339 | // Also, make sure all lines are aligned by padding the address. |
| 340 | try bw.print("{x:0>[1]} ", .{ address, @sizeOf(usize) * 2 }); | 340 | try bw.print("{x:0>[1]} ", .{ address, @sizeOf(usize) * 2 }); |
| 341 | try ttyconf.setColor(bw, .reset); | 341 | try tty_config.setColor(bw, .reset); |
| 342 | 342 | ||
| 343 | // 2. Print the bytes. | 343 | // 2. Print the bytes. |
| 344 | for (window, 0..) |byte, index| { | 344 | for (window, 0..) |byte, index| { |
| ... | @@ -358,7 +358,7 @@ pub fn dumpHexFallible(bw: *Writer, ttyconf: tty.Config, bytes: []const u8) !voi | ... | @@ -358,7 +358,7 @@ pub fn dumpHexFallible(bw: *Writer, ttyconf: tty.Config, bytes: []const u8) !voi |
| 358 | try bw.writeByte(byte); | 358 | try bw.writeByte(byte); |
| 359 | } else { | 359 | } else { |
| 360 | // Related: https://github.com/ziglang/zig/issues/7600 | 360 | // Related: https://github.com/ziglang/zig/issues/7600 |
| 361 | if (ttyconf == .windows_api) { | 361 | if (tty_config == .windows_api) { |
| 362 | try bw.writeByte('.'); | 362 | try bw.writeByte('.'); |
| 363 | continue; | 363 | continue; |
| 364 | } | 364 | } |
lib/std/enums.zig-42| ... | @@ -202,48 +202,6 @@ test "directEnumArrayDefault slice" { | ... | @@ -202,48 +202,6 @@ test "directEnumArrayDefault slice" { |
| 202 | try testing.expectEqualSlices(u8, "default", array[2]); | 202 | try testing.expectEqualSlices(u8, "default", array[2]); |
| 203 | } | 203 | } |
| 204 | 204 | ||
| 205 | /// Deprecated: Use @field(E, @tagName(tag)) or @field(E, string) | ||
| 206 | pub 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 | |||
| 225 | test 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 | |||
| 247 | test fromInt { | 205 | test fromInt { |
| 248 | const E1 = enum { | 206 | const E1 = enum { |
| 249 | A, | 207 | A, |
lib/std/heap/debug_allocator.zig+8-8| ... | @@ -460,7 +460,7 @@ pub fn DebugAllocator(comptime config: Config) type { | ... | @@ -460,7 +460,7 @@ pub fn DebugAllocator(comptime config: Config) type { |
| 460 | pub fn detectLeaks(self: *Self) usize { | 460 | pub fn detectLeaks(self: *Self) usize { |
| 461 | var leaks: usize = 0; | 461 | var leaks: usize = 0; |
| 462 | 462 | ||
| 463 | const tty_config = std.Io.tty.detectConfig(.stderr()); | 463 | const tty_config: std.Io.tty.Config = .detect(.stderr()); |
| 464 | 464 | ||
| 465 | for (self.buckets, 0..) |init_optional_bucket, size_class_index| { | 465 | for (self.buckets, 0..) |init_optional_bucket, size_class_index| { |
| 466 | var optional_bucket = init_optional_bucket; | 466 | var optional_bucket = init_optional_bucket; |
| ... | @@ -536,7 +536,7 @@ pub fn DebugAllocator(comptime config: Config) type { | ... | @@ -536,7 +536,7 @@ pub fn DebugAllocator(comptime config: Config) type { |
| 536 | fn reportDoubleFree(ret_addr: usize, alloc_stack_trace: StackTrace, free_stack_trace: StackTrace) void { | 536 | fn reportDoubleFree(ret_addr: usize, alloc_stack_trace: StackTrace, free_stack_trace: StackTrace) void { |
| 537 | var addr_buf: [stack_n]usize = undefined; | 537 | var addr_buf: [stack_n]usize = undefined; |
| 538 | const second_free_stack_trace = std.debug.captureCurrentStackTrace(.{ .first_address = ret_addr }, &addr_buf); | 538 | 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()); |
| 540 | log.err("Double free detected. Allocation: {f} First free: {f} Second free: {f}", .{ | 540 | log.err("Double free detected. Allocation: {f} First free: {f} Second free: {f}", .{ |
| 541 | std.debug.FormatStackTrace{ | 541 | std.debug.FormatStackTrace{ |
| 542 | .stack_trace = alloc_stack_trace, | 542 | .stack_trace = alloc_stack_trace, |
| ... | @@ -590,7 +590,7 @@ pub fn DebugAllocator(comptime config: Config) type { | ... | @@ -590,7 +590,7 @@ pub fn DebugAllocator(comptime config: Config) type { |
| 590 | if (config.safety and old_mem.len != entry.value_ptr.bytes.len) { | 590 | if (config.safety and old_mem.len != entry.value_ptr.bytes.len) { |
| 591 | var addr_buf: [stack_n]usize = undefined; | 591 | var addr_buf: [stack_n]usize = undefined; |
| 592 | const free_stack_trace = std.debug.captureCurrentStackTrace(.{ .first_address = ret_addr }, &addr_buf); | 592 | 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()); |
| 594 | log.err("Allocation size {d} bytes does not match free size {d}. Allocation: {f} Free: {f}", .{ | 594 | log.err("Allocation size {d} bytes does not match free size {d}. Allocation: {f} Free: {f}", .{ |
| 595 | entry.value_ptr.bytes.len, | 595 | entry.value_ptr.bytes.len, |
| 596 | old_mem.len, | 596 | old_mem.len, |
| ... | @@ -703,7 +703,7 @@ pub fn DebugAllocator(comptime config: Config) type { | ... | @@ -703,7 +703,7 @@ pub fn DebugAllocator(comptime config: Config) type { |
| 703 | if (config.safety and old_mem.len != entry.value_ptr.bytes.len) { | 703 | if (config.safety and old_mem.len != entry.value_ptr.bytes.len) { |
| 704 | var addr_buf: [stack_n]usize = undefined; | 704 | var addr_buf: [stack_n]usize = undefined; |
| 705 | const free_stack_trace = std.debug.captureCurrentStackTrace(.{ .first_address = ret_addr }, &addr_buf); | 705 | 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()); |
| 707 | log.err("Allocation size {d} bytes does not match free size {d}. Allocation: {f} Free: {f}", .{ | 707 | log.err("Allocation size {d} bytes does not match free size {d}. Allocation: {f} Free: {f}", .{ |
| 708 | entry.value_ptr.bytes.len, | 708 | entry.value_ptr.bytes.len, |
| 709 | old_mem.len, | 709 | old_mem.len, |
| ... | @@ -935,7 +935,7 @@ pub fn DebugAllocator(comptime config: Config) type { | ... | @@ -935,7 +935,7 @@ pub fn DebugAllocator(comptime config: Config) type { |
| 935 | var addr_buf: [stack_n]usize = undefined; | 935 | var addr_buf: [stack_n]usize = undefined; |
| 936 | const free_stack_trace = std.debug.captureCurrentStackTrace(.{ .first_address = return_address }, &addr_buf); | 936 | const free_stack_trace = std.debug.captureCurrentStackTrace(.{ .first_address = return_address }, &addr_buf); |
| 937 | if (old_memory.len != requested_size) { | 937 | 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()); |
| 939 | log.err("Allocation size {d} bytes does not match free size {d}. Allocation: {f} Free: {f}", .{ | 939 | log.err("Allocation size {d} bytes does not match free size {d}. Allocation: {f} Free: {f}", .{ |
| 940 | requested_size, | 940 | requested_size, |
| 941 | old_memory.len, | 941 | old_memory.len, |
| ... | @@ -950,7 +950,7 @@ pub fn DebugAllocator(comptime config: Config) type { | ... | @@ -950,7 +950,7 @@ pub fn DebugAllocator(comptime config: Config) type { |
| 950 | }); | 950 | }); |
| 951 | } | 951 | } |
| 952 | if (alignment != slot_alignment) { | 952 | if (alignment != slot_alignment) { |
| 953 | const tty_config = std.Io.tty.detectConfig(.stderr()); | 953 | const tty_config: std.Io.tty.Config = .detect(.stderr()); |
| 954 | log.err("Allocation alignment {d} does not match free alignment {d}. Allocation: {f} Free: {f}", .{ | 954 | log.err("Allocation alignment {d} does not match free alignment {d}. Allocation: {f} Free: {f}", .{ |
| 955 | slot_alignment.toByteUnits(), | 955 | slot_alignment.toByteUnits(), |
| 956 | alignment.toByteUnits(), | 956 | alignment.toByteUnits(), |
| ... | @@ -1044,7 +1044,7 @@ pub fn DebugAllocator(comptime config: Config) type { | ... | @@ -1044,7 +1044,7 @@ pub fn DebugAllocator(comptime config: Config) type { |
| 1044 | var addr_buf: [stack_n]usize = undefined; | 1044 | var addr_buf: [stack_n]usize = undefined; |
| 1045 | const free_stack_trace = std.debug.captureCurrentStackTrace(.{ .first_address = return_address }, &addr_buf); | 1045 | const free_stack_trace = std.debug.captureCurrentStackTrace(.{ .first_address = return_address }, &addr_buf); |
| 1046 | if (memory.len != requested_size) { | 1046 | if (memory.len != requested_size) { |
| 1047 | const tty_config = std.Io.tty.detectConfig(.stderr()); | 1047 | const tty_config: std.Io.tty.Config = .detect(.stderr()); |
| 1048 | log.err("Allocation size {d} bytes does not match free size {d}. Allocation: {f} Free: {f}", .{ | 1048 | log.err("Allocation size {d} bytes does not match free size {d}. Allocation: {f} Free: {f}", .{ |
| 1049 | requested_size, | 1049 | requested_size, |
| 1050 | memory.len, | 1050 | memory.len, |
| ... | @@ -1059,7 +1059,7 @@ pub fn DebugAllocator(comptime config: Config) type { | ... | @@ -1059,7 +1059,7 @@ pub fn DebugAllocator(comptime config: Config) type { |
| 1059 | }); | 1059 | }); |
| 1060 | } | 1060 | } |
| 1061 | if (alignment != slot_alignment) { | 1061 | if (alignment != slot_alignment) { |
| 1062 | const tty_config = std.Io.tty.detectConfig(.stderr()); | 1062 | const tty_config: std.Io.tty.Config = .detect(.stderr()); |
| 1063 | log.err("Allocation alignment {d} does not match free alignment {d}. Allocation: {f} Free: {f}", .{ | 1063 | log.err("Allocation alignment {d} does not match free alignment {d}. Allocation: {f} Free: {f}", .{ |
| 1064 | slot_alignment.toByteUnits(), | 1064 | slot_alignment.toByteUnits(), |
| 1065 | alignment.toByteUnits(), | 1065 | alignment.toByteUnits(), |
lib/std/http/Client.zig+1-1| ... | @@ -529,7 +529,7 @@ pub const Response = struct { | ... | @@ -529,7 +529,7 @@ pub const Response = struct { |
| 529 | }; | 529 | }; |
| 530 | if (first_line[8] != ' ') return error.HttpHeadersInvalid; | 530 | if (first_line[8] != ' ') return error.HttpHeadersInvalid; |
| 531 | const status: http.Status = @enumFromInt(parseInt3(first_line[9..12])); | 531 | 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..], " "); |
| 533 | 533 | ||
| 534 | res.version = version; | 534 | res.version = version; |
| 535 | res.status = status; | 535 | res.status = status; |
lib/std/mem.zig-6| ... | @@ -1221,9 +1221,6 @@ test trimStart { | ... | @@ -1221,9 +1221,6 @@ test trimStart { |
| 1221 | try testing.expectEqualSlices(u8, "foo\n ", trimStart(u8, " foo\n ", " \n")); | 1221 | try testing.expectEqualSlices(u8, "foo\n ", trimStart(u8, " foo\n ", " \n")); |
| 1222 | } | 1222 | } |
| 1223 | 1223 | ||
| 1224 | /// Deprecated: use `trimStart` instead. | ||
| 1225 | pub const trimLeft = trimStart; | ||
| 1226 | |||
| 1227 | /// Remove a set of values from the end of a slice. | 1224 | /// Remove a set of values from the end of a slice. |
| 1228 | pub fn trimEnd(comptime T: type, slice: []const T, values_to_strip: []const T) []const T { | 1225 | pub fn trimEnd(comptime T: type, slice: []const T, values_to_strip: []const T) []const T { |
| 1229 | var end: usize = slice.len; | 1226 | var end: usize = slice.len; |
| ... | @@ -1235,9 +1232,6 @@ test trimEnd { | ... | @@ -1235,9 +1232,6 @@ test trimEnd { |
| 1235 | try testing.expectEqualSlices(u8, " foo", trimEnd(u8, " foo\n ", " \n")); | 1232 | try testing.expectEqualSlices(u8, " foo", trimEnd(u8, " foo\n ", " \n")); |
| 1236 | } | 1233 | } |
| 1237 | 1234 | ||
| 1238 | /// Deprecated: use `trimEnd` instead. | ||
| 1239 | pub const trimRight = trimEnd; | ||
| 1240 | |||
| 1241 | /// Remove a set of values from the beginning and end of a slice. | 1235 | /// Remove a set of values from the beginning and end of a slice. |
| 1242 | pub fn trim(comptime T: type, slice: []const T, values_to_strip: []const T) []const T { | 1236 | pub fn trim(comptime T: type, slice: []const T, values_to_strip: []const T) []const T { |
| 1243 | var begin: usize = 0; | 1237 | var begin: usize = 0; |
lib/std/meta.zig-40| ... | @@ -614,38 +614,6 @@ test activeTag { | ... | @@ -614,38 +614,6 @@ test activeTag { |
| 614 | try testing.expect(activeTag(u) == UE.Float); | 614 | try testing.expect(activeTag(u) == UE.Float); |
| 615 | } | 615 | } |
| 616 | 616 | ||
| 617 | /// Deprecated: Use @FieldType(U, tag_name) | ||
| 618 | const TagPayloadType = TagPayload; | ||
| 619 | |||
| 620 | /// Deprecated: Use @FieldType(U, tag_name) | ||
| 621 | pub 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)) | ||
| 633 | pub fn TagPayload(comptime U: type, comptime tag: Tag(U)) type { | ||
| 634 | return TagPayloadByName(U, @tagName(tag)); | ||
| 635 | } | ||
| 636 | |||
| 637 | test 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 | |||
| 649 | /// Compares two of any type for equality. Containers that do not support comparison | 617 | /// Compares two of any type for equality. Containers that do not support comparison |
| 650 | /// on their own are compared on a field-by-field basis. Pointers are not followed. | 618 | /// on their own are compared on a field-by-field basis. Pointers are not followed. |
| 651 | pub fn eql(a: anytype, b: @TypeOf(a)) bool { | 619 | pub fn eql(a: anytype, b: @TypeOf(a)) bool { |
| ... | @@ -774,14 +742,6 @@ test eql { | ... | @@ -774,14 +742,6 @@ test eql { |
| 774 | try testing.expect(!eql(v1, v3)); | 742 | try testing.expect(!eql(v1, v3)); |
| 775 | } | 743 | } |
| 776 | 744 | ||
| 777 | /// Deprecated: use `std.enums.fromInt` instead and handle null. | ||
| 778 | pub const IntToEnumError = error{InvalidEnumTag}; | ||
| 779 | |||
| 780 | /// Deprecated: use `std.enums.fromInt` instead and handle null instead of an error. | ||
| 781 | pub fn intToEnum(comptime EnumTag: type, tag_int: anytype) IntToEnumError!EnumTag { | ||
| 782 | return std.enums.fromInt(EnumTag, tag_int) orelse return error.InvalidEnumTag; | ||
| 783 | } | ||
| 784 | |||
| 785 | /// Given a type and a name, return the field index according to source order. | 745 | /// Given a type and a name, return the field index according to source order. |
| 786 | /// Returns `null` if the field is not found. | 746 | /// Returns `null` if the field is not found. |
| 787 | pub fn fieldIndex(comptime T: type, comptime name: []const u8) ?comptime_int { | 747 | pub 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" { | ... | @@ -138,23 +138,23 @@ test "sigset_t" { |
| 138 | // See that none are set, then set each one, see that they're all set, then | 138 | // See that none are set, then set each one, see that they're all set, then |
| 139 | // remove them all, and then see that none are set. | 139 | // remove them all, and then see that none are set. |
| 140 | for (1..linux.NSIG) |i| { | 140 | 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; |
| 142 | try expectEqual(false, linux.sigismember(&sigset, sig)); | 142 | try expectEqual(false, linux.sigismember(&sigset, sig)); |
| 143 | } | 143 | } |
| 144 | for (1..linux.NSIG) |i| { | 144 | 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; |
| 146 | linux.sigaddset(&sigset, sig); | 146 | linux.sigaddset(&sigset, sig); |
| 147 | } | 147 | } |
| 148 | for (1..linux.NSIG) |i| { | 148 | 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; |
| 150 | try expectEqual(true, linux.sigismember(&sigset, sig)); | 150 | try expectEqual(true, linux.sigismember(&sigset, sig)); |
| 151 | } | 151 | } |
| 152 | for (1..linux.NSIG) |i| { | 152 | 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; |
| 154 | linux.sigdelset(&sigset, sig); | 154 | linux.sigdelset(&sigset, sig); |
| 155 | } | 155 | } |
| 156 | for (1..linux.NSIG) |i| { | 156 | 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; |
| 158 | try expectEqual(false, linux.sigismember(&sigset, sig)); | 158 | try expectEqual(false, linux.sigismember(&sigset, sig)); |
| 159 | } | 159 | } |
| 160 | } | 160 | } |
| ... | @@ -163,7 +163,7 @@ test "sigfillset" { | ... | @@ -163,7 +163,7 @@ test "sigfillset" { |
| 163 | // unlike the C library, all the signals are set in the kernel-level fillset | 163 | // unlike the C library, all the signals are set in the kernel-level fillset |
| 164 | const sigset = linux.sigfillset(); | 164 | const sigset = linux.sigfillset(); |
| 165 | for (1..linux.NSIG) |i| { | 165 | 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; |
| 167 | try expectEqual(true, linux.sigismember(&sigset, sig)); | 167 | try expectEqual(true, linux.sigismember(&sigset, sig)); |
| 168 | } | 168 | } |
| 169 | } | 169 | } |
| ... | @@ -171,7 +171,7 @@ test "sigfillset" { | ... | @@ -171,7 +171,7 @@ test "sigfillset" { |
| 171 | test "sigemptyset" { | 171 | test "sigemptyset" { |
| 172 | const sigset = linux.sigemptyset(); | 172 | const sigset = linux.sigemptyset(); |
| 173 | for (1..linux.NSIG) |i| { | 173 | 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; |
| 175 | try expectEqual(false, linux.sigismember(&sigset, sig)); | 175 | try expectEqual(false, linux.sigismember(&sigset, sig)); |
| 176 | } | 176 | } |
| 177 | } | 177 | } |
lib/std/os/uefi/protocol/ip6_config.zig+3-3| ... | @@ -44,7 +44,7 @@ pub const Ip6Config = extern struct { | ... | @@ -44,7 +44,7 @@ pub const Ip6Config = extern struct { |
| 44 | pub fn setData( | 44 | pub fn setData( |
| 45 | self: *const Ip6Config, | 45 | self: *const Ip6Config, |
| 46 | comptime data_type: std.meta.Tag(DataType), | 46 | comptime data_type: std.meta.Tag(DataType), |
| 47 | payload: *const std.meta.TagPayload(DataType, data_type), | 47 | payload: *const @FieldType(DataType, @tagName(data_type)), |
| 48 | ) SetDataError!void { | 48 | ) SetDataError!void { |
| 49 | const data_size = @sizeOf(@TypeOf(payload)); | 49 | const data_size = @sizeOf(@TypeOf(payload)); |
| 50 | switch (self._set_data(self, data_type, data_size, @ptrCast(payload))) { | 50 | switch (self._set_data(self, data_type, data_size, @ptrCast(payload))) { |
| ... | @@ -64,8 +64,8 @@ pub const Ip6Config = extern struct { | ... | @@ -64,8 +64,8 @@ pub const Ip6Config = extern struct { |
| 64 | pub fn getData( | 64 | pub fn getData( |
| 65 | self: *const Ip6Config, | 65 | self: *const Ip6Config, |
| 66 | comptime data_type: std.meta.Tag(DataType), | 66 | comptime data_type: std.meta.Tag(DataType), |
| 67 | ) GetDataError!std.meta.TagPayload(DataType, data_type) { | 67 | ) GetDataError!@FieldType(DataType, @tagName(data_type)) { |
| 68 | const DataPayload = std.meta.TagPayload(DataType, data_type); | 68 | const DataPayload = @FieldType(DataType, @tagName(data_type)); |
| 69 | 69 | ||
| 70 | var payload: DataPayload = undefined; | 70 | var payload: DataPayload = undefined; |
| 71 | var payload_size: usize = @sizeOf(DataPayload); | 71 | var payload_size: usize = @sizeOf(DataPayload); |
lib/std/posix/test.zig+6-6| ... | @@ -536,7 +536,7 @@ test "sigset empty/full" { | ... | @@ -536,7 +536,7 @@ test "sigset empty/full" { |
| 536 | 536 | ||
| 537 | var set: posix.sigset_t = posix.sigemptyset(); | 537 | var set: posix.sigset_t = posix.sigemptyset(); |
| 538 | for (1..posix.NSIG) |i| { | 538 | 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; |
| 540 | try expectEqual(false, posix.sigismember(&set, sig)); | 540 | try expectEqual(false, posix.sigismember(&set, sig)); |
| 541 | } | 541 | } |
| 542 | 542 | ||
| ... | @@ -565,29 +565,29 @@ test "sigset add/del" { | ... | @@ -565,29 +565,29 @@ test "sigset add/del" { |
| 565 | // See that none are set, then set each one, see that they're all set, then | 565 | // See that none are set, then set each one, see that they're all set, then |
| 566 | // remove them all, and then see that none are set. | 566 | // remove them all, and then see that none are set. |
| 567 | for (1..posix.NSIG) |i| { | 567 | 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; |
| 569 | try expectEqual(false, posix.sigismember(&sigset, sig)); | 569 | try expectEqual(false, posix.sigismember(&sigset, sig)); |
| 570 | } | 570 | } |
| 571 | for (1..posix.NSIG) |i| { | 571 | for (1..posix.NSIG) |i| { |
| 572 | if (!reserved_signo(i)) { | 572 | 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; |
| 574 | posix.sigaddset(&sigset, sig); | 574 | posix.sigaddset(&sigset, sig); |
| 575 | } | 575 | } |
| 576 | } | 576 | } |
| 577 | for (1..posix.NSIG) |i| { | 577 | for (1..posix.NSIG) |i| { |
| 578 | if (!reserved_signo(i)) { | 578 | 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; |
| 580 | try expectEqual(true, posix.sigismember(&sigset, sig)); | 580 | try expectEqual(true, posix.sigismember(&sigset, sig)); |
| 581 | } | 581 | } |
| 582 | } | 582 | } |
| 583 | for (1..posix.NSIG) |i| { | 583 | for (1..posix.NSIG) |i| { |
| 584 | if (!reserved_signo(i)) { | 584 | 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; |
| 586 | posix.sigdelset(&sigset, sig); | 586 | posix.sigdelset(&sigset, sig); |
| 587 | } | 587 | } |
| 588 | } | 588 | } |
| 589 | for (1..posix.NSIG) |i| { | 589 | 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; |
| 591 | try expectEqual(false, posix.sigismember(&sigset, sig)); | 591 | try expectEqual(false, posix.sigismember(&sigset, sig)); |
| 592 | } | 592 | } |
| 593 | } | 593 | } |
lib/std/testing.zig+1-1| ... | @@ -1160,7 +1160,7 @@ pub fn checkAllAllocationFailures(backing_allocator: std.mem.Allocator, comptime | ... | @@ -1160,7 +1160,7 @@ pub fn checkAllAllocationFailures(backing_allocator: std.mem.Allocator, comptime |
| 1160 | } else |err| switch (err) { | 1160 | } else |err| switch (err) { |
| 1161 | error.OutOfMemory => { | 1161 | error.OutOfMemory => { |
| 1162 | if (failing_allocator_inst.allocated_bytes != failing_allocator_inst.freed_bytes) { | 1162 | 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()); |
| 1164 | print( | 1164 | print( |
| 1165 | "\nfail_index: {d}/{d}\nallocated bytes: {d}\nfreed bytes: {d}\nallocations: {d}\ndeallocations: {d}\nallocation that was made to fail: {f}", | 1165 | "\nfail_index: {d}/{d}\nallocated bytes: {d}\nfreed bytes: {d}\nallocations: {d}\ndeallocations: {d}\nallocation that was made to fail: {f}", |
| 1166 | .{ | 1166 | .{ |
test/standalone/config_header/build.zig+1-1| ... | @@ -21,7 +21,7 @@ pub fn build(b: *std.Build) void { | ... | @@ -21,7 +21,7 @@ pub fn build(b: *std.Build) void { |
| 21 | }, | 21 | }, |
| 22 | ); | 22 | ); |
| 23 | 23 | ||
| 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") }); |
| 25 | 25 | ||
| 26 | const test_step = b.step("test", "Test it"); | 26 | const test_step = b.step("test", "Test it"); |
| 27 | test_step.dependOn(&check_config_header.step); | 27 | 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 { | ... | @@ -9,9 +9,9 @@ pub fn build(b: *std.Build) void { |
| 9 | }), | 9 | }), |
| 10 | }); | 10 | }); |
| 11 | if (is_windows) { | 11 | if (is_windows) { |
| 12 | test_obj.linkSystemLibrary("ntdll"); | 12 | test_obj.root_module.linkSystemLibrary("ntdll", .{}); |
| 13 | test_obj.linkSystemLibrary("kernel32"); | 13 | test_obj.root_module.linkSystemLibrary("kernel32", .{}); |
| 14 | test_obj.linkSystemLibrary("ws2_32"); | 14 | test_obj.root_module.linkSystemLibrary("ws2_32", .{}); |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | const test_exe_mod = b.createModule(.{ | 17 | const test_exe_mod = b.createModule(.{ |