| author | |
| committer | |
| log | 4c01a6553a1efef727b4f1cf7bb8dd9e53bd3cd5 |
| tree | 122051721252ae70676f0be27b1978d8caf7bb48 |
| parent | 3aa31ffd868973b202907e504ce8f38571887ee2 |
| parent | ec36e0609fb97fef96e72fb76f5515b751519a61 |
| signature |
std.fmt: delete deprecated APIs58 files changed, 128 insertions(+), 176 deletions(-)
lib/compiler/aro/aro/Diagnostics.zig+1-1| ... | ... | @@ -470,7 +470,7 @@ pub fn renderMessage(comp: *Compilation, m: anytype, msg: Message) void { |
| 470 | 470 | } |
| 471 | 471 | }.f; |
| 472 | 472 | printRt(m, prop.msg, .{"{f}"}, .{ |
| 473 | std.fmt.Formatter([]const u8, f){ .data = msg.extra.normalized }, | |
| 473 | std.fmt.Alt([]const u8, f){ .data = msg.extra.normalized }, | |
| 474 | 474 | }); |
| 475 | 475 | }, |
| 476 | 476 | .none, .offset => m.write(prop.msg), |
lib/compiler/resinator/errors.zig+1-1| ... | ... | @@ -433,7 +433,7 @@ pub const ErrorDetails = struct { |
| 433 | 433 | code_page: SupportedCodePage, |
| 434 | 434 | }; |
| 435 | 435 | |
| 436 | fn fmtToken(self: ErrorDetails, source: []const u8) std.fmt.Formatter(TokenFormatContext, formatToken) { | |
| 436 | fn fmtToken(self: ErrorDetails, source: []const u8) std.fmt.Alt(TokenFormatContext, formatToken) { | |
| 437 | 437 | return .{ .data = .{ |
| 438 | 438 | .token = self.token, |
| 439 | 439 | .code_page = self.code_page, |
lib/compiler/resinator/res.zig+1-1| ... | ... | @@ -465,7 +465,7 @@ pub const NameOrOrdinal = union(enum) { |
| 465 | 465 | } |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | pub fn fmtResourceType(type_value: NameOrOrdinal) std.fmt.Formatter(NameOrOrdinal, formatResourceType) { | |
| 468 | pub fn fmtResourceType(type_value: NameOrOrdinal) std.fmt.Alt(NameOrOrdinal, formatResourceType) { | |
| 469 | 469 | return .{ .data = type_value }; |
| 470 | 470 | } |
| 471 | 471 | }; |
lib/docs/wasm/markdown/renderer.zig+1-1| ... | ... | @@ -231,7 +231,7 @@ pub fn renderInlineNodeText( |
| 231 | 231 | } |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | pub fn fmtHtml(bytes: []const u8) std.fmt.Formatter([]const u8, formatHtml) { | |
| 234 | pub fn fmtHtml(bytes: []const u8) std.fmt.Alt([]const u8, formatHtml) { | |
| 235 | 235 | return .{ .data = bytes }; |
| 236 | 236 | } |
| 237 | 237 |
lib/std/Build/Cache/Path.zig+2-2| ... | ... | @@ -147,7 +147,7 @@ pub fn toStringZ(p: Path, allocator: Allocator) Allocator.Error![:0]u8 { |
| 147 | 147 | return std.fmt.allocPrintSentinel(allocator, "{f}", .{p}, 0); |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | pub fn fmtEscapeString(path: Path) std.fmt.Formatter(Path, formatEscapeString) { | |
| 150 | pub fn fmtEscapeString(path: Path) std.fmt.Alt(Path, formatEscapeString) { | |
| 151 | 151 | return .{ .data = path }; |
| 152 | 152 | } |
| 153 | 153 | |
| ... | ... | @@ -162,7 +162,7 @@ pub fn formatEscapeString(path: Path, writer: *std.Io.Writer) std.Io.Writer.Erro |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | /// Deprecated, use double quoted escape to print paths. |
| 165 | pub fn fmtEscapeChar(path: Path) std.fmt.Formatter(Path, formatEscapeChar) { | |
| 165 | pub fn fmtEscapeChar(path: Path) std.fmt.Alt(Path, formatEscapeChar) { | |
| 166 | 166 | return .{ .data = path }; |
| 167 | 167 | } |
| 168 | 168 |
lib/std/Build/Step/CheckObject.zig+3-3| ... | ... | @@ -595,7 +595,7 @@ fn make(step: *Step, make_options: Step.MakeOptions) !void { |
| 595 | 595 | // we either format message string with escaped codes, or not to aid debugging |
| 596 | 596 | // the failed test. |
| 597 | 597 | const fmtMessageString = struct { |
| 598 | fn fmtMessageString(kind: Check.Kind, msg: []const u8) std.fmt.Formatter(Ctx, formatMessageString) { | |
| 598 | fn fmtMessageString(kind: Check.Kind, msg: []const u8) std.fmt.Alt(Ctx, formatMessageString) { | |
| 599 | 599 | return .{ .data = .{ |
| 600 | 600 | .kind = kind, |
| 601 | 601 | .msg = msg, |
| ... | ... | @@ -2281,7 +2281,7 @@ const ElfDumper = struct { |
| 2281 | 2281 | return mem.sliceTo(@as([*:0]const u8, @ptrCast(strtab.ptr + off)), 0); |
| 2282 | 2282 | } |
| 2283 | 2283 | |
| 2284 | fn fmtShType(sh_type: u32) std.fmt.Formatter(u32, formatShType) { | |
| 2284 | fn fmtShType(sh_type: u32) std.fmt.Alt(u32, formatShType) { | |
| 2285 | 2285 | return .{ .data = sh_type }; |
| 2286 | 2286 | } |
| 2287 | 2287 | |
| ... | ... | @@ -2321,7 +2321,7 @@ const ElfDumper = struct { |
| 2321 | 2321 | try writer.writeAll(name); |
| 2322 | 2322 | } |
| 2323 | 2323 | |
| 2324 | fn fmtPhType(ph_type: u32) std.fmt.Formatter(u32, formatPhType) { | |
| 2324 | fn fmtPhType(ph_type: u32) std.fmt.Alt(u32, formatPhType) { | |
| 2325 | 2325 | return .{ .data = ph_type }; |
| 2326 | 2326 | } |
| 2327 | 2327 |
lib/std/Build/Step/Run.zig+1-1| ... | ... | @@ -1025,7 +1025,7 @@ fn formatTerm(term: ?std.process.Child.Term, w: *std.Io.Writer) std.Io.Writer.Er |
| 1025 | 1025 | try w.writeAll("exited with any code"); |
| 1026 | 1026 | } |
| 1027 | 1027 | } |
| 1028 | fn fmtTerm(term: ?std.process.Child.Term) std.fmt.Formatter(?std.process.Child.Term, formatTerm) { | |
| 1028 | fn fmtTerm(term: ?std.process.Child.Term) std.fmt.Alt(?std.process.Child.Term, formatTerm) { | |
| 1029 | 1029 | return .{ .data = term }; |
| 1030 | 1030 | } |
| 1031 | 1031 |
lib/std/Uri.zig+1-1| ... | ... | @@ -359,7 +359,7 @@ pub const Format = struct { |
| 359 | 359 | } |
| 360 | 360 | }; |
| 361 | 361 | |
| 362 | pub fn fmt(uri: *const Uri, flags: Format.Flags) std.fmt.Formatter(Format, Format.default) { | |
| 362 | pub fn fmt(uri: *const Uri, flags: Format.Flags) std.fmt.Alt(Format, Format.default) { | |
| 363 | 363 | return .{ .data = .{ .uri = uri, .flags = flags } }; |
| 364 | 364 | } |
| 365 | 365 |
lib/std/ascii.zig+1-1| ... | ... | @@ -464,7 +464,7 @@ pub const HexEscape = struct { |
| 464 | 464 | }; |
| 465 | 465 | |
| 466 | 466 | /// Replaces non-ASCII bytes with hex escapes. |
| 467 | pub fn hexEscape(bytes: []const u8, case: std.fmt.Case) std.fmt.Formatter(HexEscape, HexEscape.format) { | |
| 467 | pub fn hexEscape(bytes: []const u8, case: std.fmt.Case) std.fmt.Alt(HexEscape, HexEscape.format) { | |
| 468 | 468 | return .{ .data = .{ .bytes = bytes, .charset = switch (case) { |
| 469 | 469 | .lower => HexEscape.lower_charset, |
| 470 | 470 | .upper => HexEscape.upper_charset, |
lib/std/debug.zig+1-1| ... | ... | @@ -1697,7 +1697,7 @@ pub fn ConfigurableTrace(comptime size: usize, comptime stack_frame_count: usize |
| 1697 | 1697 | pub fn format( |
| 1698 | 1698 | t: @This(), |
| 1699 | 1699 | comptime fmt: []const u8, |
| 1700 | options: std.fmt.FormatOptions, | |
| 1700 | options: std.fmt.Options, | |
| 1701 | 1701 | writer: *Writer, |
| 1702 | 1702 | ) !void { |
| 1703 | 1703 | if (fmt.len != 0) std.fmt.invalidFmtError(fmt, t); |
lib/std/fmt.zig+2-16| ... | ... | @@ -28,9 +28,6 @@ pub const Case = enum { lower, upper }; |
| 28 | 28 | const default_alignment = .right; |
| 29 | 29 | const default_fill_char = ' '; |
| 30 | 30 | |
| 31 | /// Deprecated in favor of `Options`. | |
| 32 | pub const FormatOptions = Options; | |
| 33 | ||
| 34 | 31 | pub const Options = struct { |
| 35 | 32 | precision: ?usize = null, |
| 36 | 33 | width: ?usize = null, |
| ... | ... | @@ -77,14 +74,6 @@ pub const Number = struct { |
| 77 | 74 | }; |
| 78 | 75 | }; |
| 79 | 76 | |
| 80 | /// Deprecated in favor of `Writer.print`. | |
| 81 | pub fn format(writer: anytype, comptime fmt: []const u8, args: anytype) !void { | |
| 82 | var adapter = writer.adaptToNewApi(&.{}); | |
| 83 | return adapter.new_interface.print(fmt, args) catch |err| switch (err) { | |
| 84 | error.WriteFailed => return adapter.err.?, | |
| 85 | }; | |
| 86 | } | |
| 87 | ||
| 88 | 77 | pub const Placeholder = struct { |
| 89 | 78 | specifier_arg: []const u8, |
| 90 | 79 | fill: u8, |
| ... | ... | @@ -274,9 +263,6 @@ pub fn digits2(value: u8) [2]u8 { |
| 274 | 263 | } |
| 275 | 264 | } |
| 276 | 265 | |
| 277 | /// Deprecated in favor of `Alt`. | |
| 278 | pub const Formatter = Alt; | |
| 279 | ||
| 280 | 266 | /// Creates a type suitable for instantiating and passing to a "{f}" placeholder. |
| 281 | 267 | pub fn Alt( |
| 282 | 268 | comptime Data: type, |
| ... | ... | @@ -294,7 +280,7 @@ pub fn Alt( |
| 294 | 280 | pub fn alt( |
| 295 | 281 | context: anytype, |
| 296 | 282 | comptime func_name: @TypeOf(.enum_literal), |
| 297 | ) Formatter(@TypeOf(context), @field(@TypeOf(context), @tagName(func_name))) { | |
| 283 | ) Alt(@TypeOf(context), @field(@TypeOf(context), @tagName(func_name))) { | |
| 298 | 284 | return .{ .data = context }; |
| 299 | 285 | } |
| 300 | 286 | |
| ... | ... | @@ -607,7 +593,7 @@ pub const BufPrintError = error{ |
| 607 | 593 | NoSpaceLeft, |
| 608 | 594 | }; |
| 609 | 595 | |
| 610 | /// Print a Formatter string into `buf`. Returns a slice of the bytes printed. | |
| 596 | /// Print a format string into `buf`. Returns a slice of the bytes printed. | |
| 611 | 597 | pub fn bufPrint(buf: []u8, comptime fmt: []const u8, args: anytype) BufPrintError![]u8 { |
| 612 | 598 | var w: Writer = .fixed(buf); |
| 613 | 599 | w.print(fmt, args) catch |err| switch (err) { |
lib/std/fs/path.zig+1-1| ... | ... | @@ -146,7 +146,7 @@ pub fn joinZ(allocator: Allocator, paths: []const []const u8) ![:0]u8 { |
| 146 | 146 | return out[0 .. out.len - 1 :0]; |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | pub fn fmtJoin(paths: []const []const u8) std.fmt.Formatter([]const []const u8, formatJoin) { | |
| 149 | pub fn fmtJoin(paths: []const []const u8) std.fmt.Alt([]const []const u8, formatJoin) { | |
| 150 | 150 | return .{ .data = paths }; |
| 151 | 151 | } |
| 152 | 152 |
lib/std/unicode.zig+2-2| ... | ... | @@ -893,7 +893,7 @@ fn formatUtf8(utf8: []const u8, writer: *std.Io.Writer) std.Io.Writer.Error!void |
| 893 | 893 | /// Ill-formed UTF-8 byte sequences are replaced by the replacement character (U+FFFD) |
| 894 | 894 | /// according to "U+FFFD Substitution of Maximal Subparts" from Chapter 3 of |
| 895 | 895 | /// the Unicode standard, and as specified by https://encoding.spec.whatwg.org/#utf-8-decoder |
| 896 | pub fn fmtUtf8(utf8: []const u8) std.fmt.Formatter([]const u8, formatUtf8) { | |
| 896 | pub fn fmtUtf8(utf8: []const u8) std.fmt.Alt([]const u8, formatUtf8) { | |
| 897 | 897 | return .{ .data = utf8 }; |
| 898 | 898 | } |
| 899 | 899 | |
| ... | ... | @@ -1483,7 +1483,7 @@ fn formatUtf16Le(utf16le: []const u16, writer: *std.Io.Writer) std.Io.Writer.Err |
| 1483 | 1483 | /// Return a Formatter for a (potentially ill-formed) UTF-16 LE string, |
| 1484 | 1484 | /// which will be converted to UTF-8 during formatting. |
| 1485 | 1485 | /// Unpaired surrogates are replaced by the replacement character (U+FFFD). |
| 1486 | pub fn fmtUtf16Le(utf16le: []const u16) std.fmt.Formatter([]const u16, formatUtf16Le) { | |
| 1486 | pub fn fmtUtf16Le(utf16le: []const u16) std.fmt.Alt([]const u16, formatUtf16Le) { | |
| 1487 | 1487 | return .{ .data = utf16le }; |
| 1488 | 1488 | } |
| 1489 | 1489 |
lib/std/zig.zig+2-2| ... | ... | @@ -462,12 +462,12 @@ pub const FormatId = struct { |
| 462 | 462 | }; |
| 463 | 463 | |
| 464 | 464 | /// Return a formatter for escaping a double quoted Zig string. |
| 465 | pub fn fmtString(bytes: []const u8) std.fmt.Formatter([]const u8, stringEscape) { | |
| 465 | pub fn fmtString(bytes: []const u8) std.fmt.Alt([]const u8, stringEscape) { | |
| 466 | 466 | return .{ .data = bytes }; |
| 467 | 467 | } |
| 468 | 468 | |
| 469 | 469 | /// Return a formatter for escaping a single quoted Zig string. |
| 470 | pub fn fmtChar(c: u21) std.fmt.Formatter(u21, charEscape) { | |
| 470 | pub fn fmtChar(c: u21) std.fmt.Alt(u21, charEscape) { | |
| 471 | 471 | return .{ .data = c }; |
| 472 | 472 | } |
| 473 | 473 |
lib/std/zig/llvm/Builder.zig+16-16| ... | ... | @@ -111,7 +111,7 @@ pub const String = enum(u32) { |
| 111 | 111 | return printEscapedString(string_slice, quote_behavior, w); |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | pub fn fmt(self: String, builder: *const Builder) std.fmt.Formatter(FormatData, format) { | |
| 114 | pub fn fmt(self: String, builder: *const Builder) std.fmt.Alt(FormatData, format) { | |
| 115 | 115 | return .{ .data = .{ |
| 116 | 116 | .string = self, |
| 117 | 117 | .builder = builder, |
| ... | ... | @@ -119,7 +119,7 @@ pub const String = enum(u32) { |
| 119 | 119 | } }; |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | pub fn fmtQ(self: String, builder: *const Builder) std.fmt.Formatter(FormatData, format) { | |
| 122 | pub fn fmtQ(self: String, builder: *const Builder) std.fmt.Alt(FormatData, format) { | |
| 123 | 123 | return .{ .data = .{ |
| 124 | 124 | .string = self, |
| 125 | 125 | .builder = builder, |
| ... | ... | @@ -127,7 +127,7 @@ pub const String = enum(u32) { |
| 127 | 127 | } }; |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | pub fn fmtRaw(self: String, builder: *const Builder) std.fmt.Formatter(FormatData, format) { | |
| 130 | pub fn fmtRaw(self: String, builder: *const Builder) std.fmt.Alt(FormatData, format) { | |
| 131 | 131 | return .{ .data = .{ |
| 132 | 132 | .string = self, |
| 133 | 133 | .builder = builder, |
| ... | ... | @@ -846,7 +846,7 @@ pub const Type = enum(u32) { |
| 846 | 846 | }, |
| 847 | 847 | } |
| 848 | 848 | } |
| 849 | pub fn fmt(self: Type, builder: *const Builder, mode: FormatData.Mode) std.fmt.Formatter(FormatData, format) { | |
| 849 | pub fn fmt(self: Type, builder: *const Builder, mode: FormatData.Mode) std.fmt.Alt(FormatData, format) { | |
| 850 | 850 | return .{ .data = .{ .type = self, .builder = builder, .mode = mode } }; |
| 851 | 851 | } |
| 852 | 852 | |
| ... | ... | @@ -1325,7 +1325,7 @@ pub const Attribute = union(Kind) { |
| 1325 | 1325 | .none => unreachable, |
| 1326 | 1326 | } |
| 1327 | 1327 | } |
| 1328 | pub fn fmt(self: Index, builder: *const Builder, mode: FormatData.mode) std.fmt.Formatter(FormatData, format) { | |
| 1328 | pub fn fmt(self: Index, builder: *const Builder, mode: FormatData.mode) std.fmt.Alt(FormatData, format) { | |
| 1329 | 1329 | return .{ .data = .{ .attribute_index = self, .builder = builder, .mode = mode } }; |
| 1330 | 1330 | } |
| 1331 | 1331 | |
| ... | ... | @@ -1609,7 +1609,7 @@ pub const Attributes = enum(u32) { |
| 1609 | 1609 | .flags = data.flags, |
| 1610 | 1610 | }, w); |
| 1611 | 1611 | } |
| 1612 | pub fn fmt(self: Attributes, builder: *const Builder, flags: FormatData.Flags) std.fmt.Formatter(FormatData, format) { | |
| 1612 | pub fn fmt(self: Attributes, builder: *const Builder, flags: FormatData.Flags) std.fmt.Alt(FormatData, format) { | |
| 1613 | 1613 | return .{ .data = .{ .attributes = self, .builder = builder, .flags = flags } }; |
| 1614 | 1614 | } |
| 1615 | 1615 | }; |
| ... | ... | @@ -1803,7 +1803,7 @@ pub const Linkage = enum(u4) { |
| 1803 | 1803 | fn formatOptional(data: ?Linkage, w: *Writer) Writer.Error!void { |
| 1804 | 1804 | if (data) |linkage| try w.print(" {s}", .{@tagName(linkage)}); |
| 1805 | 1805 | } |
| 1806 | pub fn fmtOptional(self: ?Linkage) std.fmt.Formatter(?Linkage, formatOptional) { | |
| 1806 | pub fn fmtOptional(self: ?Linkage) std.fmt.Alt(?Linkage, formatOptional) { | |
| 1807 | 1807 | return .{ .data = self }; |
| 1808 | 1808 | } |
| 1809 | 1809 | }; |
| ... | ... | @@ -2208,7 +2208,7 @@ pub const StrtabString = enum(u32) { |
| 2208 | 2208 | self: StrtabString, |
| 2209 | 2209 | builder: *const Builder, |
| 2210 | 2210 | quote_behavior: ?QuoteBehavior, |
| 2211 | ) std.fmt.Formatter(FormatData, format) { | |
| 2211 | ) std.fmt.Alt(FormatData, format) { | |
| 2212 | 2212 | return .{ .data = .{ |
| 2213 | 2213 | .string = self, |
| 2214 | 2214 | .builder = builder, |
| ... | ... | @@ -2387,7 +2387,7 @@ pub const Global = struct { |
| 2387 | 2387 | data.global.unwrap(data.builder).name(data.builder).fmt(data.builder, .quote_unless_valid_identifier), |
| 2388 | 2388 | }); |
| 2389 | 2389 | } |
| 2390 | pub fn fmt(self: Index, builder: *const Builder) std.fmt.Formatter(FormatData, format) { | |
| 2390 | pub fn fmt(self: Index, builder: *const Builder) std.fmt.Alt(FormatData, format) { | |
| 2391 | 2391 | return .{ .data = .{ .global = self, .builder = builder } }; |
| 2392 | 2392 | } |
| 2393 | 2393 | |
| ... | ... | @@ -4852,7 +4852,7 @@ pub const Function = struct { |
| 4852 | 4852 | function: Function.Index, |
| 4853 | 4853 | builder: *Builder, |
| 4854 | 4854 | flags: FormatFlags, |
| 4855 | ) std.fmt.Formatter(FormatData, format) { | |
| 4855 | ) std.fmt.Alt(FormatData, format) { | |
| 4856 | 4856 | return .{ .data = .{ |
| 4857 | 4857 | .instruction = self, |
| 4858 | 4858 | .function = function, |
| ... | ... | @@ -7790,7 +7790,7 @@ pub const Constant = enum(u32) { |
| 7790 | 7790 | .global => |global| try w.print("{f}", .{global.fmt(data.builder)}), |
| 7791 | 7791 | } |
| 7792 | 7792 | } |
| 7793 | pub fn fmt(self: Constant, builder: *Builder, flags: FormatFlags) std.fmt.Formatter(FormatData, format) { | |
| 7793 | pub fn fmt(self: Constant, builder: *Builder, flags: FormatFlags) std.fmt.Alt(FormatData, format) { | |
| 7794 | 7794 | return .{ .data = .{ |
| 7795 | 7795 | .constant = self, |
| 7796 | 7796 | .builder = builder, |
| ... | ... | @@ -7868,7 +7868,7 @@ pub const Value = enum(u32) { |
| 7868 | 7868 | .metadata => unreachable, |
| 7869 | 7869 | } |
| 7870 | 7870 | } |
| 7871 | pub fn fmt(self: Value, function: Function.Index, builder: *Builder, flags: FormatFlags) std.fmt.Formatter(FormatData, format) { | |
| 7871 | pub fn fmt(self: Value, function: Function.Index, builder: *Builder, flags: FormatFlags) std.fmt.Alt(FormatData, format) { | |
| 7872 | 7872 | return .{ .data = .{ .value = self, .function = function, .builder = builder, .flags = flags } }; |
| 7873 | 7873 | } |
| 7874 | 7874 | }; |
| ... | ... | @@ -7902,7 +7902,7 @@ pub const MetadataString = enum(u32) { |
| 7902 | 7902 | fn format(data: FormatData, w: *Writer) Writer.Error!void { |
| 7903 | 7903 | try printEscapedString(data.metadata_string.slice(data.builder), .always_quote, w); |
| 7904 | 7904 | } |
| 7905 | fn fmt(self: MetadataString, builder: *const Builder) std.fmt.Formatter(FormatData, format) { | |
| 7905 | fn fmt(self: MetadataString, builder: *const Builder) std.fmt.Alt(FormatData, format) { | |
| 7906 | 7906 | return .{ .data = .{ .metadata_string = self, .builder = builder } }; |
| 7907 | 7907 | } |
| 7908 | 7908 | }; |
| ... | ... | @@ -8411,7 +8411,7 @@ pub const Metadata = enum(u32) { |
| 8411 | 8411 | inline fn fmt(formatter: *Formatter, prefix: []const u8, node: anytype, special: ?FormatFlags) switch (@TypeOf(node)) { |
| 8412 | 8412 | Metadata => Allocator.Error, |
| 8413 | 8413 | else => error{}, |
| 8414 | }!std.fmt.Formatter(FormatData, format) { | |
| 8414 | }!std.fmt.Alt(FormatData, format) { | |
| 8415 | 8415 | const Node = @TypeOf(node); |
| 8416 | 8416 | const MaybeNode = switch (@typeInfo(Node)) { |
| 8417 | 8417 | .optional => Node, |
| ... | ... | @@ -8456,7 +8456,7 @@ pub const Metadata = enum(u32) { |
| 8456 | 8456 | prefix: []const u8, |
| 8457 | 8457 | value: Value, |
| 8458 | 8458 | function: Function.Index, |
| 8459 | ) Allocator.Error!std.fmt.Formatter(FormatData, format) { | |
| 8459 | ) Allocator.Error!std.fmt.Alt(FormatData, format) { | |
| 8460 | 8460 | return .{ .data = .{ |
| 8461 | 8461 | .formatter = formatter, |
| 8462 | 8462 | .prefix = prefix, |
| ... | ... | @@ -8539,7 +8539,7 @@ pub const Metadata = enum(u32) { |
| 8539 | 8539 | fmt_str = fmt_str ++ "("; |
| 8540 | 8540 | inline for (fields[2..], names) |*field, name| { |
| 8541 | 8541 | fmt_str = fmt_str ++ "{[" ++ name ++ "]f}"; |
| 8542 | const T = std.fmt.Formatter(FormatData, format); | |
| 8542 | const T = std.fmt.Alt(FormatData, format); | |
| 8543 | 8543 | field.* = .{ |
| 8544 | 8544 | .name = name, |
| 8545 | 8545 | .type = T, |
lib/std/zig/string_literal.zig+1-1| ... | ... | @@ -87,7 +87,7 @@ pub const Error = union(enum) { |
| 87 | 87 | } |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | pub fn fmt(self: @This(), raw_string: []const u8) std.fmt.Formatter(FormatMessage, formatMessage) { | |
| 90 | pub fn fmt(self: @This(), raw_string: []const u8) std.fmt.Alt(FormatMessage, formatMessage) { | |
| 91 | 91 | return .{ .data = .{ |
| 92 | 92 | .err = self, |
| 93 | 93 | .raw_string = raw_string, |
src/Compilation.zig+1-1| ... | ... | @@ -6465,7 +6465,7 @@ fn updateWin32Resource(comp: *Compilation, win32_resource: *Win32Resource, win32 |
| 6465 | 6465 | }; |
| 6466 | 6466 | } |
| 6467 | 6467 | |
| 6468 | pub fn fmtRcEscape(bytes: []const u8) std.fmt.Formatter([]const u8, formatRcEscape) { | |
| 6468 | pub fn fmtRcEscape(bytes: []const u8) std.fmt.Alt([]const u8, formatRcEscape) { | |
| 6469 | 6469 | return .{ .data = bytes }; |
| 6470 | 6470 | } |
| 6471 | 6471 | }.fmtRcEscape; |
src/InternPool.zig+2-2| ... | ... | @@ -1904,11 +1904,11 @@ pub const NullTerminatedString = enum(u32) { |
| 1904 | 1904 | } |
| 1905 | 1905 | } |
| 1906 | 1906 | |
| 1907 | pub fn fmt(string: NullTerminatedString, ip: *const InternPool) std.fmt.Formatter(FormatData, format) { | |
| 1907 | pub fn fmt(string: NullTerminatedString, ip: *const InternPool) std.fmt.Alt(FormatData, format) { | |
| 1908 | 1908 | return .{ .data = .{ .string = string, .ip = ip, .id = false } }; |
| 1909 | 1909 | } |
| 1910 | 1910 | |
| 1911 | pub fn fmtId(string: NullTerminatedString, ip: *const InternPool) std.fmt.Formatter(FormatData, format) { | |
| 1911 | pub fn fmtId(string: NullTerminatedString, ip: *const InternPool) std.fmt.Alt(FormatData, format) { | |
| 1912 | 1912 | return .{ .data = .{ .string = string, .ip = ip, .id = true } }; |
| 1913 | 1913 | } |
| 1914 | 1914 |
src/Type.zig+2-2| ... | ... | @@ -127,7 +127,7 @@ pub fn format(ty: Type, writer: *std.Io.Writer) !void { |
| 127 | 127 | @compileError("do not format types directly; use either ty.fmtDebug() or ty.fmt()"); |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | pub const Formatter = std.fmt.Formatter(Format, Format.default); | |
| 130 | pub const Formatter = std.fmt.Alt(Format, Format.default); | |
| 131 | 131 | |
| 132 | 132 | pub fn fmt(ty: Type, pt: Zcu.PerThread) Formatter { |
| 133 | 133 | return .{ .data = .{ |
| ... | ... | @@ -145,7 +145,7 @@ const Format = struct { |
| 145 | 145 | } |
| 146 | 146 | }; |
| 147 | 147 | |
| 148 | pub fn fmtDebug(ty: Type) std.fmt.Formatter(Type, dump) { | |
| 148 | pub fn fmtDebug(ty: Type) std.fmt.Alt(Type, dump) { | |
| 149 | 149 | return .{ .data = ty }; |
| 150 | 150 | } |
| 151 | 151 |
src/Value.zig+4-4| ... | ... | @@ -27,11 +27,11 @@ pub fn dump(start_val: Value, w: std.Io.Writer) std.Io.Writer.Error!void { |
| 27 | 27 | try w.print("(interned: {})", .{start_val.toIntern()}); |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | pub fn fmtDebug(val: Value) std.fmt.Formatter(Value, dump) { | |
| 30 | pub fn fmtDebug(val: Value) std.fmt.Alt(Value, dump) { | |
| 31 | 31 | return .{ .data = val }; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | pub fn fmtValue(val: Value, pt: Zcu.PerThread) std.fmt.Formatter(print_value.FormatContext, print_value.format) { | |
| 34 | pub fn fmtValue(val: Value, pt: Zcu.PerThread) std.fmt.Alt(print_value.FormatContext, print_value.format) { | |
| 35 | 35 | return .{ .data = .{ |
| 36 | 36 | .val = val, |
| 37 | 37 | .pt = pt, |
| ... | ... | @@ -40,7 +40,7 @@ pub fn fmtValue(val: Value, pt: Zcu.PerThread) std.fmt.Formatter(print_value.For |
| 40 | 40 | } }; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | pub fn fmtValueSema(val: Value, pt: Zcu.PerThread, sema: *Sema) std.fmt.Formatter(print_value.FormatContext, print_value.formatSema) { | |
| 43 | pub fn fmtValueSema(val: Value, pt: Zcu.PerThread, sema: *Sema) std.fmt.Alt(print_value.FormatContext, print_value.formatSema) { | |
| 44 | 44 | return .{ .data = .{ |
| 45 | 45 | .val = val, |
| 46 | 46 | .pt = pt, |
| ... | ... | @@ -49,7 +49,7 @@ pub fn fmtValueSema(val: Value, pt: Zcu.PerThread, sema: *Sema) std.fmt.Formatte |
| 49 | 49 | } }; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | pub fn fmtValueSemaFull(ctx: print_value.FormatContext) std.fmt.Formatter(print_value.FormatContext, print_value.formatSema) { | |
| 52 | pub fn fmtValueSemaFull(ctx: print_value.FormatContext) std.fmt.Alt(print_value.FormatContext, print_value.formatSema) { | |
| 53 | 53 | return .{ .data = ctx }; |
| 54 | 54 | } |
| 55 | 55 |
src/Zcu.zig+2-2| ... | ... | @@ -4306,10 +4306,10 @@ pub fn navFileScope(zcu: *Zcu, nav: InternPool.Nav.Index) *File { |
| 4306 | 4306 | return zcu.fileByIndex(zcu.navFileScopeIndex(nav)); |
| 4307 | 4307 | } |
| 4308 | 4308 | |
| 4309 | pub fn fmtAnalUnit(zcu: *Zcu, unit: AnalUnit) std.fmt.Formatter(FormatAnalUnit, formatAnalUnit) { | |
| 4309 | pub fn fmtAnalUnit(zcu: *Zcu, unit: AnalUnit) std.fmt.Alt(FormatAnalUnit, formatAnalUnit) { | |
| 4310 | 4310 | return .{ .data = .{ .unit = unit, .zcu = zcu } }; |
| 4311 | 4311 | } |
| 4312 | pub fn fmtDependee(zcu: *Zcu, d: InternPool.Dependee) std.fmt.Formatter(FormatDependee, formatDependee) { | |
| 4312 | pub fn fmtDependee(zcu: *Zcu, d: InternPool.Dependee) std.fmt.Alt(FormatDependee, formatDependee) { | |
| 4313 | 4313 | return .{ .data = .{ .dependee = d, .zcu = zcu } }; |
| 4314 | 4314 | } |
| 4315 | 4315 |
src/arch/riscv64/CodeGen.zig+4-4| ... | ... | @@ -972,7 +972,7 @@ fn formatWipMir(data: FormatWipMirData, writer: *std.Io.Writer) std.Io.Writer.Er |
| 972 | 972 | first = false; |
| 973 | 973 | } |
| 974 | 974 | } |
| 975 | fn fmtWipMir(func: *Func, inst: Mir.Inst.Index) std.fmt.Formatter(FormatWipMirData, formatWipMir) { | |
| 975 | fn fmtWipMir(func: *Func, inst: Mir.Inst.Index) std.fmt.Alt(FormatWipMirData, formatWipMir) { | |
| 976 | 976 | return .{ .data = .{ .func = func, .inst = inst } }; |
| 977 | 977 | } |
| 978 | 978 | |
| ... | ... | @@ -983,7 +983,7 @@ const FormatNavData = struct { |
| 983 | 983 | fn formatNav(data: FormatNavData, writer: *std.Io.Writer) std.Io.Writer.Error!void { |
| 984 | 984 | try writer.print("{f}", .{data.ip.getNav(data.nav_index).fqn.fmt(data.ip)}); |
| 985 | 985 | } |
| 986 | fn fmtNav(nav_index: InternPool.Nav.Index, ip: *const InternPool) std.fmt.Formatter(FormatNavData, formatNav) { | |
| 986 | fn fmtNav(nav_index: InternPool.Nav.Index, ip: *const InternPool) std.fmt.Alt(FormatNavData, formatNav) { | |
| 987 | 987 | return .{ .data = .{ |
| 988 | 988 | .ip = ip, |
| 989 | 989 | .nav_index = nav_index, |
| ... | ... | @@ -1001,7 +1001,7 @@ fn formatAir(data: FormatAirData, writer: *std.Io.Writer) std.Io.Writer.Error!vo |
| 1001 | 1001 | _ = writer; |
| 1002 | 1002 | @panic("unimplemented"); |
| 1003 | 1003 | } |
| 1004 | fn fmtAir(func: *Func, inst: Air.Inst.Index) std.fmt.Formatter(FormatAirData, formatAir) { | |
| 1004 | fn fmtAir(func: *Func, inst: Air.Inst.Index) std.fmt.Alt(FormatAirData, formatAir) { | |
| 1005 | 1005 | return .{ .data = .{ .func = func, .inst = inst } }; |
| 1006 | 1006 | } |
| 1007 | 1007 | |
| ... | ... | @@ -1012,7 +1012,7 @@ fn formatTracking(data: FormatTrackingData, writer: *std.Io.Writer) std.Io.Write |
| 1012 | 1012 | var it = data.func.inst_tracking.iterator(); |
| 1013 | 1013 | while (it.next()) |entry| try writer.print("\n%{d} = {f}", .{ entry.key_ptr.*, entry.value_ptr.* }); |
| 1014 | 1014 | } |
| 1015 | fn fmtTracking(func: *Func) std.fmt.Formatter(FormatTrackingData, formatTracking) { | |
| 1015 | fn fmtTracking(func: *Func) std.fmt.Alt(FormatTrackingData, formatTracking) { | |
| 1016 | 1016 | return .{ .data = .{ .func = func } }; |
| 1017 | 1017 | } |
| 1018 | 1018 |
src/arch/x86_64/CodeGen.zig+4-4| ... | ... | @@ -1091,7 +1091,7 @@ const FormatNavData = struct { |
| 1091 | 1091 | fn formatNav(data: FormatNavData, w: *Writer) Writer.Error!void { |
| 1092 | 1092 | try w.print("{f}", .{data.ip.getNav(data.nav_index).fqn.fmt(data.ip)}); |
| 1093 | 1093 | } |
| 1094 | fn fmtNav(nav_index: InternPool.Nav.Index, ip: *const InternPool) std.fmt.Formatter(FormatNavData, formatNav) { | |
| 1094 | fn fmtNav(nav_index: InternPool.Nav.Index, ip: *const InternPool) std.fmt.Alt(FormatNavData, formatNav) { | |
| 1095 | 1095 | return .{ .data = .{ |
| 1096 | 1096 | .ip = ip, |
| 1097 | 1097 | .nav_index = nav_index, |
| ... | ... | @@ -1105,7 +1105,7 @@ const FormatAirData = struct { |
| 1105 | 1105 | fn formatAir(data: FormatAirData, w: *Writer) Writer.Error!void { |
| 1106 | 1106 | data.self.air.writeInst(w, data.inst, data.self.pt, data.self.liveness); |
| 1107 | 1107 | } |
| 1108 | fn fmtAir(self: *CodeGen, inst: Air.Inst.Index) std.fmt.Formatter(FormatAirData, formatAir) { | |
| 1108 | fn fmtAir(self: *CodeGen, inst: Air.Inst.Index) std.fmt.Alt(FormatAirData, formatAir) { | |
| 1109 | 1109 | return .{ .data = .{ .self = self, .inst = inst } }; |
| 1110 | 1110 | } |
| 1111 | 1111 | |
| ... | ... | @@ -1197,7 +1197,7 @@ fn formatWipMir(data: FormatWipMirData, w: *Writer) Writer.Error!void { |
| 1197 | 1197 | } |
| 1198 | 1198 | } |
| 1199 | 1199 | } |
| 1200 | fn fmtWipMir(self: *CodeGen, inst: Mir.Inst.Index) std.fmt.Formatter(FormatWipMirData, formatWipMir) { | |
| 1200 | fn fmtWipMir(self: *CodeGen, inst: Mir.Inst.Index) std.fmt.Alt(FormatWipMirData, formatWipMir) { | |
| 1201 | 1201 | return .{ .data = .{ .self = self, .inst = inst } }; |
| 1202 | 1202 | } |
| 1203 | 1203 | |
| ... | ... | @@ -1208,7 +1208,7 @@ fn formatTracking(data: FormatTrackingData, w: *Writer) Writer.Error!void { |
| 1208 | 1208 | var it = data.self.inst_tracking.iterator(); |
| 1209 | 1209 | while (it.next()) |entry| try w.print("\n{f} = {f}", .{ entry.key_ptr.*, entry.value_ptr.* }); |
| 1210 | 1210 | } |
| 1211 | fn fmtTracking(self: *CodeGen) std.fmt.Formatter(FormatTrackingData, formatTracking) { | |
| 1211 | fn fmtTracking(self: *CodeGen) std.fmt.Alt(FormatTrackingData, formatTracking) { | |
| 1212 | 1212 | return .{ .data = .{ .self = self } }; |
| 1213 | 1213 | } |
| 1214 | 1214 |
src/arch/x86_64/encoder.zig+1-1| ... | ... | @@ -301,7 +301,7 @@ pub const Instruction = struct { |
| 301 | 301 | } |
| 302 | 302 | }; |
| 303 | 303 | |
| 304 | pub fn fmt(op: Operand, enc_op: Encoding.Op) std.fmt.Formatter(Format, Format.default) { | |
| 304 | pub fn fmt(op: Operand, enc_op: Encoding.Op) std.fmt.Alt(Format, Format.default) { | |
| 305 | 305 | return .{ .data = .{ .op = op, .enc_op = enc_op } }; |
| 306 | 306 | } |
| 307 | 307 | }; |
src/codegen/c.zig+10-10| ... | ... | @@ -371,11 +371,11 @@ fn formatIdentOptions(ident: []const u8, w: *Writer, solo: bool) Writer.Error!vo |
| 371 | 371 | } |
| 372 | 372 | } |
| 373 | 373 | |
| 374 | pub fn fmtIdentSolo(ident: []const u8) std.fmt.Formatter([]const u8, formatIdentSolo) { | |
| 374 | pub fn fmtIdentSolo(ident: []const u8) std.fmt.Alt([]const u8, formatIdentSolo) { | |
| 375 | 375 | return .{ .data = ident }; |
| 376 | 376 | } |
| 377 | 377 | |
| 378 | pub fn fmtIdentUnsolo(ident: []const u8) std.fmt.Formatter([]const u8, formatIdentUnsolo) { | |
| 378 | pub fn fmtIdentUnsolo(ident: []const u8) std.fmt.Alt([]const u8, formatIdentUnsolo) { | |
| 379 | 379 | return .{ .data = ident }; |
| 380 | 380 | } |
| 381 | 381 | |
| ... | ... | @@ -394,7 +394,7 @@ pub fn fmtCTypePoolString( |
| 394 | 394 | ctype_pool_string: CType.Pool.String, |
| 395 | 395 | ctype_pool: *const CType.Pool, |
| 396 | 396 | solo: bool, |
| 397 | ) std.fmt.Formatter(CTypePoolStringFormatData, formatCTypePoolString) { | |
| 397 | ) std.fmt.Alt(CTypePoolStringFormatData, formatCTypePoolString) { | |
| 398 | 398 | return .{ .data = .{ |
| 399 | 399 | .ctype_pool_string = ctype_pool_string, |
| 400 | 400 | .ctype_pool = ctype_pool, |
| ... | ... | @@ -610,11 +610,11 @@ pub const Function = struct { |
| 610 | 610 | return f.object.dg.renderIntCast(w, dest_ty, .{ .c_value = .{ .f = f, .value = src, .v = v } }, src_ty, location); |
| 611 | 611 | } |
| 612 | 612 | |
| 613 | fn fmtIntLiteralDec(f: *Function, val: Value) !std.fmt.Formatter(FormatIntLiteralContext, formatIntLiteral) { | |
| 613 | fn fmtIntLiteralDec(f: *Function, val: Value) !std.fmt.Alt(FormatIntLiteralContext, formatIntLiteral) { | |
| 614 | 614 | return f.object.dg.fmtIntLiteralDec(val, .Other); |
| 615 | 615 | } |
| 616 | 616 | |
| 617 | fn fmtIntLiteralHex(f: *Function, val: Value) !std.fmt.Formatter(FormatIntLiteralContext, formatIntLiteral) { | |
| 617 | fn fmtIntLiteralHex(f: *Function, val: Value) !std.fmt.Alt(FormatIntLiteralContext, formatIntLiteral) { | |
| 618 | 618 | return f.object.dg.fmtIntLiteralHex(val, .Other); |
| 619 | 619 | } |
| 620 | 620 | |
| ... | ... | @@ -1919,7 +1919,7 @@ pub const DeclGen = struct { |
| 1919 | 1919 | kind: CType.Kind, |
| 1920 | 1920 | name: union(enum) { |
| 1921 | 1921 | nav: InternPool.Nav.Index, |
| 1922 | fmt_ctype_pool_string: std.fmt.Formatter(CTypePoolStringFormatData, formatCTypePoolString), | |
| 1922 | fmt_ctype_pool_string: std.fmt.Alt(CTypePoolStringFormatData, formatCTypePoolString), | |
| 1923 | 1923 | @"export": struct { |
| 1924 | 1924 | main_name: InternPool.NullTerminatedString, |
| 1925 | 1925 | extern_name: InternPool.NullTerminatedString, |
| ... | ... | @@ -2439,7 +2439,7 @@ pub const DeclGen = struct { |
| 2439 | 2439 | loc: ValueRenderLocation, |
| 2440 | 2440 | base: u8, |
| 2441 | 2441 | case: std.fmt.Case, |
| 2442 | ) !std.fmt.Formatter(FormatIntLiteralContext, formatIntLiteral) { | |
| 2442 | ) !std.fmt.Alt(FormatIntLiteralContext, formatIntLiteral) { | |
| 2443 | 2443 | const zcu = dg.pt.zcu; |
| 2444 | 2444 | const kind = loc.toCTypeKind(); |
| 2445 | 2445 | const ty = val.typeOf(zcu); |
| ... | ... | @@ -2461,7 +2461,7 @@ pub const DeclGen = struct { |
| 2461 | 2461 | dg: *DeclGen, |
| 2462 | 2462 | val: Value, |
| 2463 | 2463 | loc: ValueRenderLocation, |
| 2464 | ) !std.fmt.Formatter(FormatIntLiteralContext, formatIntLiteral) { | |
| 2464 | ) !std.fmt.Alt(FormatIntLiteralContext, formatIntLiteral) { | |
| 2465 | 2465 | return fmtIntLiteral(dg, val, loc, 10, .lower); |
| 2466 | 2466 | } |
| 2467 | 2467 | |
| ... | ... | @@ -2469,7 +2469,7 @@ pub const DeclGen = struct { |
| 2469 | 2469 | dg: *DeclGen, |
| 2470 | 2470 | val: Value, |
| 2471 | 2471 | loc: ValueRenderLocation, |
| 2472 | ) !std.fmt.Formatter(FormatIntLiteralContext, formatIntLiteral) { | |
| 2472 | ) !std.fmt.Alt(FormatIntLiteralContext, formatIntLiteral) { | |
| 2473 | 2473 | return fmtIntLiteral(dg, val, loc, 16, .lower); |
| 2474 | 2474 | } |
| 2475 | 2475 | }; |
| ... | ... | @@ -8295,7 +8295,7 @@ fn formatStringLiteral(data: FormatStringContext, w: *Writer) Writer.Error!void |
| 8295 | 8295 | try literal.end(); |
| 8296 | 8296 | } |
| 8297 | 8297 | |
| 8298 | fn fmtStringLiteral(str: []const u8, sentinel: ?u8) std.fmt.Formatter(FormatStringContext, formatStringLiteral) { | |
| 8298 | fn fmtStringLiteral(str: []const u8, sentinel: ?u8) std.fmt.Alt(FormatStringContext, formatStringLiteral) { | |
| 8299 | 8299 | return .{ .data = .{ .str = str, .sentinel = sentinel } }; |
| 8300 | 8300 | } |
| 8301 | 8301 |
src/codegen/c/Type.zig+1-1| ... | ... | @@ -989,7 +989,7 @@ pub const Pool = struct { |
| 989 | 989 | else |
| 990 | 990 | try writer.print("f{d}", .{@intFromEnum(data.string.index)}); |
| 991 | 991 | } |
| 992 | pub fn fmt(str: String, pool: *const Pool) std.fmt.Formatter(FormatData, format) { | |
| 992 | pub fn fmt(str: String, pool: *const Pool) std.fmt.Alt(FormatData, format) { | |
| 993 | 993 | return .{ .data = .{ .string = str, .pool = pool } }; |
| 994 | 994 | } |
| 995 | 995 |
src/link/Coff.zig+1-1| ... | ... | @@ -3053,7 +3053,7 @@ const ImportTable = struct { |
| 3053 | 3053 | } |
| 3054 | 3054 | }; |
| 3055 | 3055 | |
| 3056 | fn fmtDebug(itab: ImportTable, ctx: Context) fmt.Formatter(Format, Format.default) { | |
| 3056 | fn fmtDebug(itab: ImportTable, ctx: Context) fmt.Alt(Format, Format.default) { | |
| 3057 | 3057 | return .{ .data = .{ .itab = itab, .ctx = ctx } }; |
| 3058 | 3058 | } |
| 3059 | 3059 |
src/link/Elf.zig+4-4| ... | ... | @@ -3862,7 +3862,7 @@ const FormatShdr = struct { |
| 3862 | 3862 | shdr: elf.Elf64_Shdr, |
| 3863 | 3863 | }; |
| 3864 | 3864 | |
| 3865 | fn fmtShdr(self: *Elf, shdr: elf.Elf64_Shdr) std.fmt.Formatter(FormatShdr, formatShdr) { | |
| 3865 | fn fmtShdr(self: *Elf, shdr: elf.Elf64_Shdr) std.fmt.Alt(FormatShdr, formatShdr) { | |
| 3866 | 3866 | return .{ .data = .{ |
| 3867 | 3867 | .shdr = shdr, |
| 3868 | 3868 | .elf_file = self, |
| ... | ... | @@ -3879,7 +3879,7 @@ fn formatShdr(ctx: FormatShdr, writer: *std.Io.Writer) std.Io.Writer.Error!void |
| 3879 | 3879 | }); |
| 3880 | 3880 | } |
| 3881 | 3881 | |
| 3882 | pub fn fmtShdrFlags(sh_flags: u64) std.fmt.Formatter(u64, formatShdrFlags) { | |
| 3882 | pub fn fmtShdrFlags(sh_flags: u64) std.fmt.Alt(u64, formatShdrFlags) { | |
| 3883 | 3883 | return .{ .data = sh_flags }; |
| 3884 | 3884 | } |
| 3885 | 3885 | |
| ... | ... | @@ -3933,7 +3933,7 @@ const FormatPhdr = struct { |
| 3933 | 3933 | phdr: elf.Elf64_Phdr, |
| 3934 | 3934 | }; |
| 3935 | 3935 | |
| 3936 | fn fmtPhdr(self: *Elf, phdr: elf.Elf64_Phdr) std.fmt.Formatter(FormatPhdr, formatPhdr) { | |
| 3936 | fn fmtPhdr(self: *Elf, phdr: elf.Elf64_Phdr) std.fmt.Alt(FormatPhdr, formatPhdr) { | |
| 3937 | 3937 | return .{ .data = .{ |
| 3938 | 3938 | .phdr = phdr, |
| 3939 | 3939 | .elf_file = self, |
| ... | ... | @@ -3967,7 +3967,7 @@ fn formatPhdr(ctx: FormatPhdr, writer: *std.Io.Writer) std.Io.Writer.Error!void |
| 3967 | 3967 | }); |
| 3968 | 3968 | } |
| 3969 | 3969 | |
| 3970 | pub fn dumpState(self: *Elf) std.fmt.Formatter(*Elf, fmtDumpState) { | |
| 3970 | pub fn dumpState(self: *Elf) std.fmt.Alt(*Elf, fmtDumpState) { | |
| 3971 | 3971 | return .{ .data = self }; |
| 3972 | 3972 | } |
| 3973 | 3973 |
src/link/Elf/Archive.zig+1-1| ... | ... | @@ -215,7 +215,7 @@ pub const ArSymtab = struct { |
| 215 | 215 | } |
| 216 | 216 | }; |
| 217 | 217 | |
| 218 | pub fn fmt(ar: ArSymtab, elf_file: *Elf) std.fmt.Formatter(Format, Format.default) { | |
| 218 | pub fn fmt(ar: ArSymtab, elf_file: *Elf) std.fmt.Alt(Format, Format.default) { | |
| 219 | 219 | return .{ .data = .{ |
| 220 | 220 | .ar = ar, |
| 221 | 221 | .elf_file = elf_file, |
src/link/Elf/Atom.zig+1-1| ... | ... | @@ -894,7 +894,7 @@ pub fn setExtra(atom: Atom, extras: Extra, elf_file: *Elf) void { |
| 894 | 894 | atom.file(elf_file).?.setAtomExtra(atom.extra_index, extras); |
| 895 | 895 | } |
| 896 | 896 | |
| 897 | pub fn fmt(atom: Atom, elf_file: *Elf) std.fmt.Formatter(Format, Format.default) { | |
| 897 | pub fn fmt(atom: Atom, elf_file: *Elf) std.fmt.Alt(Format, Format.default) { | |
| 898 | 898 | return .{ .data = .{ |
| 899 | 899 | .atom = atom, |
| 900 | 900 | .elf_file = elf_file, |
src/link/Elf/AtomList.zig+1-1| ... | ... | @@ -187,7 +187,7 @@ const Format = struct { |
| 187 | 187 | } |
| 188 | 188 | }; |
| 189 | 189 | |
| 190 | pub fn fmt(atom_list: AtomList, elf_file: *Elf) std.fmt.Formatter(Format, Format.default) { | |
| 190 | pub fn fmt(atom_list: AtomList, elf_file: *Elf) std.fmt.Alt(Format, Format.default) { | |
| 191 | 191 | return .{ .data = .{ .atom_list = atom_list, .elf_file = elf_file } }; |
| 192 | 192 | } |
| 193 | 193 |
src/link/Elf/LinkerDefined.zig+1-1| ... | ... | @@ -437,7 +437,7 @@ pub fn setSymbolExtra(self: *LinkerDefined, index: u32, extra: Symbol.Extra) voi |
| 437 | 437 | } |
| 438 | 438 | } |
| 439 | 439 | |
| 440 | pub fn fmtSymtab(self: *LinkerDefined, elf_file: *Elf) std.fmt.Formatter(Format, Format.symtab) { | |
| 440 | pub fn fmtSymtab(self: *LinkerDefined, elf_file: *Elf) std.fmt.Alt(Format, Format.symtab) { | |
| 441 | 441 | return .{ .data = .{ |
| 442 | 442 | .self = self, |
| 443 | 443 | .elf_file = elf_file, |
src/link/Elf/Merge.zig+2-2| ... | ... | @@ -157,7 +157,7 @@ pub const Section = struct { |
| 157 | 157 | } |
| 158 | 158 | }; |
| 159 | 159 | |
| 160 | pub fn fmt(msec: Section, elf_file: *Elf) std.fmt.Formatter(Format, Format.default) { | |
| 160 | pub fn fmt(msec: Section, elf_file: *Elf) std.fmt.Alt(Format, Format.default) { | |
| 161 | 161 | return .{ .data = .{ |
| 162 | 162 | .msec = msec, |
| 163 | 163 | .elf_file = elf_file, |
| ... | ... | @@ -211,7 +211,7 @@ pub const Subsection = struct { |
| 211 | 211 | return msec.bytes.items[msub.string_index..][0..msub.size]; |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | pub fn fmt(msub: Subsection, elf_file: *Elf) std.fmt.Formatter(Format, Format.default) { | |
| 214 | pub fn fmt(msub: Subsection, elf_file: *Elf) std.fmt.Alt(Format, Format.default) { | |
| 215 | 215 | return .{ .data = .{ |
| 216 | 216 | .msub = msub, |
| 217 | 217 | .elf_file = elf_file, |
src/link/Elf/Object.zig+6-6| ... | ... | @@ -1431,7 +1431,7 @@ pub fn group(self: *Object, index: Elf.Group.Index) *Elf.Group { |
| 1431 | 1431 | return &self.groups.items[index]; |
| 1432 | 1432 | } |
| 1433 | 1433 | |
| 1434 | pub fn fmtSymtab(self: *Object, elf_file: *Elf) std.fmt.Formatter(Format, Format.symtab) { | |
| 1434 | pub fn fmtSymtab(self: *Object, elf_file: *Elf) std.fmt.Alt(Format, Format.symtab) { | |
| 1435 | 1435 | return .{ .data = .{ |
| 1436 | 1436 | .object = self, |
| 1437 | 1437 | .elf_file = elf_file, |
| ... | ... | @@ -1504,35 +1504,35 @@ const Format = struct { |
| 1504 | 1504 | } |
| 1505 | 1505 | }; |
| 1506 | 1506 | |
| 1507 | pub fn fmtAtoms(self: *Object, elf_file: *Elf) std.fmt.Formatter(Format, Format.atoms) { | |
| 1507 | pub fn fmtAtoms(self: *Object, elf_file: *Elf) std.fmt.Alt(Format, Format.atoms) { | |
| 1508 | 1508 | return .{ .data = .{ |
| 1509 | 1509 | .object = self, |
| 1510 | 1510 | .elf_file = elf_file, |
| 1511 | 1511 | } }; |
| 1512 | 1512 | } |
| 1513 | 1513 | |
| 1514 | pub fn fmtCies(self: *Object, elf_file: *Elf) std.fmt.Formatter(Format, Format.cies) { | |
| 1514 | pub fn fmtCies(self: *Object, elf_file: *Elf) std.fmt.Alt(Format, Format.cies) { | |
| 1515 | 1515 | return .{ .data = .{ |
| 1516 | 1516 | .object = self, |
| 1517 | 1517 | .elf_file = elf_file, |
| 1518 | 1518 | } }; |
| 1519 | 1519 | } |
| 1520 | 1520 | |
| 1521 | pub fn fmtFdes(self: *Object, elf_file: *Elf) std.fmt.Formatter(Format, Format.fdes) { | |
| 1521 | pub fn fmtFdes(self: *Object, elf_file: *Elf) std.fmt.Alt(Format, Format.fdes) { | |
| 1522 | 1522 | return .{ .data = .{ |
| 1523 | 1523 | .object = self, |
| 1524 | 1524 | .elf_file = elf_file, |
| 1525 | 1525 | } }; |
| 1526 | 1526 | } |
| 1527 | 1527 | |
| 1528 | pub fn fmtGroups(self: *Object, elf_file: *Elf) std.fmt.Formatter(Format, Format.groups) { | |
| 1528 | pub fn fmtGroups(self: *Object, elf_file: *Elf) std.fmt.Alt(Format, Format.groups) { | |
| 1529 | 1529 | return .{ .data = .{ |
| 1530 | 1530 | .object = self, |
| 1531 | 1531 | .elf_file = elf_file, |
| 1532 | 1532 | } }; |
| 1533 | 1533 | } |
| 1534 | 1534 | |
| 1535 | pub fn fmtPath(self: Object) std.fmt.Formatter(Object, formatPath) { | |
| 1535 | pub fn fmtPath(self: Object) std.fmt.Alt(Object, formatPath) { | |
| 1536 | 1536 | return .{ .data = self }; |
| 1537 | 1537 | } |
| 1538 | 1538 |
src/link/Elf/SharedObject.zig+1-1| ... | ... | @@ -509,7 +509,7 @@ pub fn setSymbolExtra(self: *SharedObject, index: u32, extra: Symbol.Extra) void |
| 509 | 509 | } |
| 510 | 510 | } |
| 511 | 511 | |
| 512 | pub fn fmtSymtab(self: SharedObject, elf_file: *Elf) std.fmt.Formatter(Format, Format.symtab) { | |
| 512 | pub fn fmtSymtab(self: SharedObject, elf_file: *Elf) std.fmt.Alt(Format, Format.symtab) { | |
| 513 | 513 | return .{ .data = .{ |
| 514 | 514 | .shared = self, |
| 515 | 515 | .elf_file = elf_file, |
src/link/Elf/Symbol.zig+2-2| ... | ... | @@ -368,14 +368,14 @@ const Format = struct { |
| 368 | 368 | } |
| 369 | 369 | }; |
| 370 | 370 | |
| 371 | pub fn fmtName(symbol: Symbol, elf_file: *Elf) std.fmt.Formatter(Format, Format.name) { | |
| 371 | pub fn fmtName(symbol: Symbol, elf_file: *Elf) std.fmt.Alt(Format, Format.name) { | |
| 372 | 372 | return .{ .data = .{ |
| 373 | 373 | .symbol = symbol, |
| 374 | 374 | .elf_file = elf_file, |
| 375 | 375 | } }; |
| 376 | 376 | } |
| 377 | 377 | |
| 378 | pub fn fmt(symbol: Symbol, elf_file: *Elf) std.fmt.Formatter(Format, Format.default) { | |
| 378 | pub fn fmt(symbol: Symbol, elf_file: *Elf) std.fmt.Alt(Format, Format.default) { | |
| 379 | 379 | return .{ .data = .{ |
| 380 | 380 | .symbol = symbol, |
| 381 | 381 | .elf_file = elf_file, |
src/link/Elf/Thunk.zig+1-1| ... | ... | @@ -65,7 +65,7 @@ fn trampolineSize(cpu_arch: std.Target.Cpu.Arch) usize { |
| 65 | 65 | }; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | pub fn fmt(thunk: Thunk, elf_file: *Elf) std.fmt.Formatter(Format, Format.default) { | |
| 68 | pub fn fmt(thunk: Thunk, elf_file: *Elf) std.fmt.Alt(Format, Format.default) { | |
| 69 | 69 | return .{ .data = .{ |
| 70 | 70 | .thunk = thunk, |
| 71 | 71 | .elf_file = elf_file, |
src/link/Elf/ZigObject.zig+2-2| ... | ... | @@ -2225,14 +2225,14 @@ const Format = struct { |
| 2225 | 2225 | } |
| 2226 | 2226 | }; |
| 2227 | 2227 | |
| 2228 | pub fn fmtSymtab(self: *ZigObject, elf_file: *Elf) std.fmt.Formatter(Format, Format.symtab) { | |
| 2228 | pub fn fmtSymtab(self: *ZigObject, elf_file: *Elf) std.fmt.Alt(Format, Format.symtab) { | |
| 2229 | 2229 | return .{ .data = .{ |
| 2230 | 2230 | .self = self, |
| 2231 | 2231 | .elf_file = elf_file, |
| 2232 | 2232 | } }; |
| 2233 | 2233 | } |
| 2234 | 2234 | |
| 2235 | pub fn fmtAtoms(self: *ZigObject, elf_file: *Elf) std.fmt.Formatter(Format, Format.atoms) { | |
| 2235 | pub fn fmtAtoms(self: *ZigObject, elf_file: *Elf) std.fmt.Alt(Format, Format.atoms) { | |
| 2236 | 2236 | return .{ .data = .{ |
| 2237 | 2237 | .self = self, |
| 2238 | 2238 | .elf_file = elf_file, |
src/link/Elf/eh_frame.zig+2-2| ... | ... | @@ -47,7 +47,7 @@ pub const Fde = struct { |
| 47 | 47 | return object.relocs.items[fde.rel_index..][0..fde.rel_num]; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | pub fn fmt(fde: Fde, elf_file: *Elf) std.fmt.Formatter(Format, Format.default) { | |
| 50 | pub fn fmt(fde: Fde, elf_file: *Elf) std.fmt.Alt(Format, Format.default) { | |
| 51 | 51 | return .{ .data = .{ |
| 52 | 52 | .fde = fde, |
| 53 | 53 | .elf_file = elf_file, |
| ... | ... | @@ -130,7 +130,7 @@ pub const Cie = struct { |
| 130 | 130 | return true; |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | pub fn fmt(cie: Cie, elf_file: *Elf) std.fmt.Formatter(Format, Format.default) { | |
| 133 | pub fn fmt(cie: Cie, elf_file: *Elf) std.fmt.Alt(Format, Format.default) { | |
| 134 | 134 | return .{ .data = .{ |
| 135 | 135 | .cie = cie, |
| 136 | 136 | .elf_file = elf_file, |
src/link/Elf/file.zig+1-1| ... | ... | @@ -10,7 +10,7 @@ pub const File = union(enum) { |
| 10 | 10 | }; |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | pub fn fmtPath(file: File) std.fmt.Formatter(File, formatPath) { | |
| 13 | pub fn fmtPath(file: File) std.fmt.Alt(File, formatPath) { | |
| 14 | 14 | return .{ .data = file }; |
| 15 | 15 | } |
| 16 | 16 |
src/link/Elf/relocation.zig+1-1| ... | ... | @@ -153,7 +153,7 @@ const FormatRelocTypeCtx = struct { |
| 153 | 153 | cpu_arch: std.Target.Cpu.Arch, |
| 154 | 154 | }; |
| 155 | 155 | |
| 156 | pub fn fmtRelocType(r_type: u32, cpu_arch: std.Target.Cpu.Arch) std.fmt.Formatter(FormatRelocTypeCtx, formatRelocType) { | |
| 156 | pub fn fmtRelocType(r_type: u32, cpu_arch: std.Target.Cpu.Arch) std.fmt.Alt(FormatRelocTypeCtx, formatRelocType) { | |
| 157 | 157 | return .{ .data = .{ |
| 158 | 158 | .r_type = r_type, |
| 159 | 159 | .cpu_arch = cpu_arch, |
src/link/Elf/synthetic_sections.zig+2-2| ... | ... | @@ -622,7 +622,7 @@ pub const GotSection = struct { |
| 622 | 622 | } |
| 623 | 623 | }; |
| 624 | 624 | |
| 625 | pub fn fmt(got: GotSection, elf_file: *Elf) std.fmt.Formatter(Format, Format.default) { | |
| 625 | pub fn fmt(got: GotSection, elf_file: *Elf) std.fmt.Alt(Format, Format.default) { | |
| 626 | 626 | return .{ .data = .{ .got = got, .elf_file = elf_file } }; |
| 627 | 627 | } |
| 628 | 628 | }; |
| ... | ... | @@ -758,7 +758,7 @@ pub const PltSection = struct { |
| 758 | 758 | } |
| 759 | 759 | }; |
| 760 | 760 | |
| 761 | pub fn fmt(plt: PltSection, elf_file: *Elf) std.fmt.Formatter(Format, Format.default) { | |
| 761 | pub fn fmt(plt: PltSection, elf_file: *Elf) std.fmt.Alt(Format, Format.default) { | |
| 762 | 762 | return .{ .data = .{ .plt = plt, .elf_file = elf_file } }; |
| 763 | 763 | } |
| 764 | 764 |
src/link/MachO.zig+5-5| ... | ... | @@ -3906,7 +3906,7 @@ pub fn ptraceDetach(self: *MachO, pid: std.posix.pid_t) !void { |
| 3906 | 3906 | self.hot_state.mach_task = null; |
| 3907 | 3907 | } |
| 3908 | 3908 | |
| 3909 | pub fn dumpState(self: *MachO) std.fmt.Formatter(*MachO, fmtDumpState) { | |
| 3909 | pub fn dumpState(self: *MachO) std.fmt.Alt(*MachO, fmtDumpState) { | |
| 3910 | 3910 | return .{ .data = self }; |
| 3911 | 3911 | } |
| 3912 | 3912 | |
| ... | ... | @@ -3964,7 +3964,7 @@ fn fmtDumpState(self: *MachO, w: *Writer) Writer.Error!void { |
| 3964 | 3964 | try w.print("segments\n{f}\n", .{self.fmtSegments()}); |
| 3965 | 3965 | } |
| 3966 | 3966 | |
| 3967 | fn fmtSections(self: *MachO) std.fmt.Formatter(*MachO, formatSections) { | |
| 3967 | fn fmtSections(self: *MachO) std.fmt.Alt(*MachO, formatSections) { | |
| 3968 | 3968 | return .{ .data = self }; |
| 3969 | 3969 | } |
| 3970 | 3970 | |
| ... | ... | @@ -3981,7 +3981,7 @@ fn formatSections(self: *MachO, w: *Writer) Writer.Error!void { |
| 3981 | 3981 | } |
| 3982 | 3982 | } |
| 3983 | 3983 | |
| 3984 | fn fmtSegments(self: *MachO) std.fmt.Formatter(*MachO, formatSegments) { | |
| 3984 | fn fmtSegments(self: *MachO) std.fmt.Alt(*MachO, formatSegments) { | |
| 3985 | 3985 | return .{ .data = self }; |
| 3986 | 3986 | } |
| 3987 | 3987 | |
| ... | ... | @@ -3994,7 +3994,7 @@ fn formatSegments(self: *MachO, w: *Writer) Writer.Error!void { |
| 3994 | 3994 | } |
| 3995 | 3995 | } |
| 3996 | 3996 | |
| 3997 | pub fn fmtSectType(tt: u8) std.fmt.Formatter(u8, formatSectType) { | |
| 3997 | pub fn fmtSectType(tt: u8) std.fmt.Alt(u8, formatSectType) { | |
| 3998 | 3998 | return .{ .data = tt }; |
| 3999 | 3999 | } |
| 4000 | 4000 | |
| ... | ... | @@ -4257,7 +4257,7 @@ pub const Platform = struct { |
| 4257 | 4257 | return false; |
| 4258 | 4258 | } |
| 4259 | 4259 | |
| 4260 | pub fn fmtTarget(plat: Platform, cpu_arch: std.Target.Cpu.Arch) std.fmt.Formatter(Format, Format.target) { | |
| 4260 | pub fn fmtTarget(plat: Platform, cpu_arch: std.Target.Cpu.Arch) std.fmt.Alt(Format, Format.target) { | |
| 4261 | 4261 | return .{ .data = .{ .platform = plat, .cpu_arch = cpu_arch } }; |
| 4262 | 4262 | } |
| 4263 | 4263 |
src/link/MachO/Archive.zig+1-1| ... | ... | @@ -225,7 +225,7 @@ pub const ArSymtab = struct { |
| 225 | 225 | } |
| 226 | 226 | }; |
| 227 | 227 | |
| 228 | pub fn fmt(ar: ArSymtab, macho_file: *MachO) std.fmt.Formatter(PrintFormat, PrintFormat.default) { | |
| 228 | pub fn fmt(ar: ArSymtab, macho_file: *MachO) std.fmt.Alt(PrintFormat, PrintFormat.default) { | |
| 229 | 229 | return .{ .data = .{ .ar = ar, .macho_file = macho_file } }; |
| 230 | 230 | } |
| 231 | 231 |
src/link/MachO/Atom.zig+1-1| ... | ... | @@ -1073,7 +1073,7 @@ pub fn writeRelocs(self: Atom, macho_file: *MachO, code: []u8, buffer: []macho.r |
| 1073 | 1073 | assert(i == buffer.len); |
| 1074 | 1074 | } |
| 1075 | 1075 | |
| 1076 | pub fn fmt(atom: Atom, macho_file: *MachO) std.fmt.Formatter(Format, Format.print) { | |
| 1076 | pub fn fmt(atom: Atom, macho_file: *MachO) std.fmt.Alt(Format, Format.print) { | |
| 1077 | 1077 | return .{ .data = .{ |
| 1078 | 1078 | .atom = atom, |
| 1079 | 1079 | .macho_file = macho_file, |
src/link/MachO/Dylib.zig+1-1| ... | ... | @@ -667,7 +667,7 @@ pub fn setSymbolExtra(self: *Dylib, index: u32, extra: Symbol.Extra) void { |
| 667 | 667 | } |
| 668 | 668 | } |
| 669 | 669 | |
| 670 | pub fn fmtSymtab(self: *Dylib, macho_file: *MachO) std.fmt.Formatter(Format, Format.symtab) { | |
| 670 | pub fn fmtSymtab(self: *Dylib, macho_file: *MachO) std.fmt.Alt(Format, Format.symtab) { | |
| 671 | 671 | return .{ .data = .{ |
| 672 | 672 | .dylib = self, |
| 673 | 673 | .macho_file = macho_file, |
src/link/MachO/InternalObject.zig+2-2| ... | ... | @@ -864,14 +864,14 @@ const Format = struct { |
| 864 | 864 | } |
| 865 | 865 | }; |
| 866 | 866 | |
| 867 | pub fn fmtAtoms(self: *InternalObject, macho_file: *MachO) std.fmt.Formatter(Format, Format.atoms) { | |
| 867 | pub fn fmtAtoms(self: *InternalObject, macho_file: *MachO) std.fmt.Alt(Format, Format.atoms) { | |
| 868 | 868 | return .{ .data = .{ |
| 869 | 869 | .self = self, |
| 870 | 870 | .macho_file = macho_file, |
| 871 | 871 | } }; |
| 872 | 872 | } |
| 873 | 873 | |
| 874 | pub fn fmtSymtab(self: *InternalObject, macho_file: *MachO) std.fmt.Formatter(Format, Format.symtab) { | |
| 874 | pub fn fmtSymtab(self: *InternalObject, macho_file: *MachO) std.fmt.Alt(Format, Format.symtab) { | |
| 875 | 875 | return .{ .data = .{ |
| 876 | 876 | .self = self, |
| 877 | 877 | .macho_file = macho_file, |
src/link/MachO/Object.zig+7-7| ... | ... | @@ -2578,42 +2578,42 @@ const Format = struct { |
| 2578 | 2578 | } |
| 2579 | 2579 | }; |
| 2580 | 2580 | |
| 2581 | pub fn fmtAtoms(self: *Object, macho_file: *MachO) std.fmt.Formatter(Format, Format.atoms) { | |
| 2581 | pub fn fmtAtoms(self: *Object, macho_file: *MachO) std.fmt.Alt(Format, Format.atoms) { | |
| 2582 | 2582 | return .{ .data = .{ |
| 2583 | 2583 | .object = self, |
| 2584 | 2584 | .macho_file = macho_file, |
| 2585 | 2585 | } }; |
| 2586 | 2586 | } |
| 2587 | 2587 | |
| 2588 | pub fn fmtCies(self: *Object, macho_file: *MachO) std.fmt.Formatter(Format, Format.cies) { | |
| 2588 | pub fn fmtCies(self: *Object, macho_file: *MachO) std.fmt.Alt(Format, Format.cies) { | |
| 2589 | 2589 | return .{ .data = .{ |
| 2590 | 2590 | .object = self, |
| 2591 | 2591 | .macho_file = macho_file, |
| 2592 | 2592 | } }; |
| 2593 | 2593 | } |
| 2594 | 2594 | |
| 2595 | pub fn fmtFdes(self: *Object, macho_file: *MachO) std.fmt.Formatter(Format, Format.fdes) { | |
| 2595 | pub fn fmtFdes(self: *Object, macho_file: *MachO) std.fmt.Alt(Format, Format.fdes) { | |
| 2596 | 2596 | return .{ .data = .{ |
| 2597 | 2597 | .object = self, |
| 2598 | 2598 | .macho_file = macho_file, |
| 2599 | 2599 | } }; |
| 2600 | 2600 | } |
| 2601 | 2601 | |
| 2602 | pub fn fmtUnwindRecords(self: *Object, macho_file: *MachO) std.fmt.Formatter(Format, Format.unwindRecords) { | |
| 2602 | pub fn fmtUnwindRecords(self: *Object, macho_file: *MachO) std.fmt.Alt(Format, Format.unwindRecords) { | |
| 2603 | 2603 | return .{ .data = .{ |
| 2604 | 2604 | .object = self, |
| 2605 | 2605 | .macho_file = macho_file, |
| 2606 | 2606 | } }; |
| 2607 | 2607 | } |
| 2608 | 2608 | |
| 2609 | pub fn fmtSymtab(self: *Object, macho_file: *MachO) std.fmt.Formatter(Format, Format.symtab) { | |
| 2609 | pub fn fmtSymtab(self: *Object, macho_file: *MachO) std.fmt.Alt(Format, Format.symtab) { | |
| 2610 | 2610 | return .{ .data = .{ |
| 2611 | 2611 | .object = self, |
| 2612 | 2612 | .macho_file = macho_file, |
| 2613 | 2613 | } }; |
| 2614 | 2614 | } |
| 2615 | 2615 | |
| 2616 | pub fn fmtPath(self: Object) std.fmt.Formatter(Object, formatPath) { | |
| 2616 | pub fn fmtPath(self: Object) std.fmt.Alt(Object, formatPath) { | |
| 2617 | 2617 | return .{ .data = self }; |
| 2618 | 2618 | } |
| 2619 | 2619 | |
| ... | ... | @@ -2694,7 +2694,7 @@ const StabFile = struct { |
| 2694 | 2694 | } |
| 2695 | 2695 | }; |
| 2696 | 2696 | |
| 2697 | pub fn fmt(stab: Stab, object: Object) std.fmt.Formatter(Stab.Format, Stab.Format.default) { | |
| 2697 | pub fn fmt(stab: Stab, object: Object) std.fmt.Alt(Stab.Format, Stab.Format.default) { | |
| 2698 | 2698 | return .{ .data = .{ .stab = stab, .object = object } }; |
| 2699 | 2699 | } |
| 2700 | 2700 | }; |
src/link/MachO/Relocation.zig+1-1| ... | ... | @@ -70,7 +70,7 @@ pub fn lessThan(ctx: void, lhs: Relocation, rhs: Relocation) bool { |
| 70 | 70 | return lhs.offset < rhs.offset; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | pub fn fmtPretty(rel: Relocation, cpu_arch: std.Target.Cpu.Arch) std.fmt.Formatter(Format, Format.pretty) { | |
| 73 | pub fn fmtPretty(rel: Relocation, cpu_arch: std.Target.Cpu.Arch) std.fmt.Alt(Format, Format.pretty) { | |
| 74 | 74 | return .{ .data = .{ .relocation = rel, .arch = cpu_arch } }; |
| 75 | 75 | } |
| 76 | 76 |
src/link/MachO/Symbol.zig+1-1| ... | ... | @@ -286,7 +286,7 @@ pub fn setOutputSym(symbol: Symbol, macho_file: *MachO, out: *macho.nlist_64) vo |
| 286 | 286 | } |
| 287 | 287 | } |
| 288 | 288 | |
| 289 | pub fn fmt(symbol: Symbol, macho_file: *MachO) std.fmt.Formatter(Format, Format.default) { | |
| 289 | pub fn fmt(symbol: Symbol, macho_file: *MachO) std.fmt.Alt(Format, Format.default) { | |
| 290 | 290 | return .{ .data = .{ |
| 291 | 291 | .symbol = symbol, |
| 292 | 292 | .macho_file = macho_file, |
src/link/MachO/Thunk.zig+1-1| ... | ... | @@ -63,7 +63,7 @@ pub fn writeSymtab(thunk: Thunk, macho_file: *MachO, ctx: anytype) void { |
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | pub fn fmt(thunk: Thunk, macho_file: *MachO) std.fmt.Formatter(Format, Format.default) { | |
| 66 | pub fn fmt(thunk: Thunk, macho_file: *MachO) std.fmt.Alt(Format, Format.default) { | |
| 67 | 67 | return .{ .data = .{ |
| 68 | 68 | .thunk = thunk, |
| 69 | 69 | .macho_file = macho_file, |
src/link/MachO/UnwindInfo.zig+2-2| ... | ... | @@ -509,7 +509,7 @@ pub const Record = struct { |
| 509 | 509 | return lsda.getAddress(macho_file) + rec.lsda_offset; |
| 510 | 510 | } |
| 511 | 511 | |
| 512 | pub fn fmt(rec: Record, macho_file: *MachO) std.fmt.Formatter(Format, Format.default) { | |
| 512 | pub fn fmt(rec: Record, macho_file: *MachO) std.fmt.Alt(Format, Format.default) { | |
| 513 | 513 | return .{ .data = .{ |
| 514 | 514 | .rec = rec, |
| 515 | 515 | .macho_file = macho_file, |
| ... | ... | @@ -603,7 +603,7 @@ const Page = struct { |
| 603 | 603 | } |
| 604 | 604 | }; |
| 605 | 605 | |
| 606 | fn fmt(page: Page, info: UnwindInfo) std.fmt.Formatter(Format, Format.default) { | |
| 606 | fn fmt(page: Page, info: UnwindInfo) std.fmt.Alt(Format, Format.default) { | |
| 607 | 607 | return .{ .data = .{ |
| 608 | 608 | .page = page, |
| 609 | 609 | .info = info, |
src/link/MachO/ZigObject.zig+2-2| ... | ... | @@ -1680,7 +1680,7 @@ pub fn asFile(self: *ZigObject) File { |
| 1680 | 1680 | return .{ .zig_object = self }; |
| 1681 | 1681 | } |
| 1682 | 1682 | |
| 1683 | pub fn fmtSymtab(self: *ZigObject, macho_file: *MachO) std.fmt.Formatter(Format, Format.symtab) { | |
| 1683 | pub fn fmtSymtab(self: *ZigObject, macho_file: *MachO) std.fmt.Alt(Format, Format.symtab) { | |
| 1684 | 1684 | return .{ .data = .{ |
| 1685 | 1685 | .self = self, |
| 1686 | 1686 | .macho_file = macho_file, |
| ... | ... | @@ -1717,7 +1717,7 @@ const Format = struct { |
| 1717 | 1717 | } |
| 1718 | 1718 | }; |
| 1719 | 1719 | |
| 1720 | pub fn fmtAtoms(self: *ZigObject, macho_file: *MachO) std.fmt.Formatter(Format, Format.atoms) { | |
| 1720 | pub fn fmtAtoms(self: *ZigObject, macho_file: *MachO) std.fmt.Alt(Format, Format.atoms) { | |
| 1721 | 1721 | return .{ .data = .{ |
| 1722 | 1722 | .self = self, |
| 1723 | 1723 | .macho_file = macho_file, |
src/link/MachO/eh_frame.zig+2-2| ... | ... | @@ -79,7 +79,7 @@ pub const Cie = struct { |
| 79 | 79 | return true; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | pub fn fmt(cie: Cie, macho_file: *MachO) std.fmt.Formatter(Format, Format.default) { | |
| 82 | pub fn fmt(cie: Cie, macho_file: *MachO) std.fmt.Alt(Format, Format.default) { | |
| 83 | 83 | return .{ .data = .{ |
| 84 | 84 | .cie = cie, |
| 85 | 85 | .macho_file = macho_file, |
| ... | ... | @@ -208,7 +208,7 @@ pub const Fde = struct { |
| 208 | 208 | return fde.getObject(macho_file).getAtom(fde.lsda); |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | pub fn fmt(fde: Fde, macho_file: *MachO) std.fmt.Formatter(Format, Format.default) { | |
| 211 | pub fn fmt(fde: Fde, macho_file: *MachO) std.fmt.Alt(Format, Format.default) { | |
| 212 | 212 | return .{ .data = .{ |
| 213 | 213 | .fde = fde, |
| 214 | 214 | .macho_file = macho_file, |
src/link/MachO/file.zig+1-1| ... | ... | @@ -10,7 +10,7 @@ pub const File = union(enum) { |
| 10 | 10 | }; |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | pub fn fmtPath(file: File) std.fmt.Formatter(File, formatPath) { | |
| 13 | pub fn fmtPath(file: File) std.fmt.Alt(File, formatPath) { | |
| 14 | 14 | return .{ .data = file }; |
| 15 | 15 | } |
| 16 | 16 |
src/link/MachO/synthetic.zig+4-4| ... | ... | @@ -55,7 +55,7 @@ pub const GotSection = struct { |
| 55 | 55 | } |
| 56 | 56 | }; |
| 57 | 57 | |
| 58 | pub fn fmt(got: GotSection, macho_file: *MachO) std.fmt.Formatter(Format, Format.print) { | |
| 58 | pub fn fmt(got: GotSection, macho_file: *MachO) std.fmt.Alt(Format, Format.print) { | |
| 59 | 59 | return .{ .data = .{ .got = got, .macho_file = macho_file } }; |
| 60 | 60 | } |
| 61 | 61 | }; |
| ... | ... | @@ -120,7 +120,7 @@ pub const StubsSection = struct { |
| 120 | 120 | } |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | pub fn fmt(stubs: StubsSection, macho_file: *MachO) std.fmt.Formatter(Format, Format.print) { | |
| 123 | pub fn fmt(stubs: StubsSection, macho_file: *MachO) std.fmt.Alt(Format, Format.print) { | |
| 124 | 124 | return .{ .data = .{ .stubs = stubs, .macho_file = macho_file } }; |
| 125 | 125 | } |
| 126 | 126 | |
| ... | ... | @@ -337,7 +337,7 @@ pub const TlvPtrSection = struct { |
| 337 | 337 | } |
| 338 | 338 | } |
| 339 | 339 | |
| 340 | pub fn fmt(tlv: TlvPtrSection, macho_file: *MachO) std.fmt.Formatter(Format, Format.print) { | |
| 340 | pub fn fmt(tlv: TlvPtrSection, macho_file: *MachO) std.fmt.Alt(Format, Format.print) { | |
| 341 | 341 | return .{ .data = .{ .tlv = tlv, .macho_file = macho_file } }; |
| 342 | 342 | } |
| 343 | 343 | |
| ... | ... | @@ -452,7 +452,7 @@ pub const ObjcStubsSection = struct { |
| 452 | 452 | } |
| 453 | 453 | } |
| 454 | 454 | |
| 455 | pub fn fmt(objc: ObjcStubsSection, macho_file: *MachO) std.fmt.Formatter(Format, Format.print) { | |
| 455 | pub fn fmt(objc: ObjcStubsSection, macho_file: *MachO) std.fmt.Alt(Format, Format.print) { | |
| 456 | 456 | return .{ .data = .{ .objc = objc, .macho_file = macho_file } }; |
| 457 | 457 | } |
| 458 | 458 |
test/behavior.zig-1| ... | ... | @@ -100,7 +100,6 @@ test { |
| 100 | 100 | _ = @import("behavior/undefined.zig"); |
| 101 | 101 | _ = @import("behavior/underscore.zig"); |
| 102 | 102 | _ = @import("behavior/union.zig"); |
| 103 | _ = @import("behavior/union_with_members.zig"); | |
| 104 | 103 | _ = @import("behavior/var_args.zig"); |
| 105 | 104 | _ = @import("behavior/vector.zig"); |
| 106 | 105 | _ = @import("behavior/void.zig"); |
test/behavior/union_with_members.zig deleted-33| ... | ... | @@ -1,33 +0,0 @@ |
| 1 | const builtin = @import("builtin"); | |
| 2 | const std = @import("std"); | |
| 3 | const expect = std.testing.expect; | |
| 4 | const mem = std.mem; | |
| 5 | const fmt = std.fmt; | |
| 6 | ||
| 7 | const ET = union(enum) { | |
| 8 | SINT: i32, | |
| 9 | UINT: u32, | |
| 10 | ||
| 11 | pub fn print(a: *const ET, buf: []u8) anyerror!usize { | |
| 12 | return switch (a.*) { | |
| 13 | ET.SINT => |x| fmt.printInt(buf, x, 10, .lower, fmt.FormatOptions{}), | |
| 14 | ET.UINT => |x| fmt.printInt(buf, x, 10, .lower, fmt.FormatOptions{}), | |
| 15 | }; | |
| 16 | } | |
| 17 | }; | |
| 18 | ||
| 19 | test "enum with members" { | |
| 20 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | |
| 21 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | |
| 22 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 23 | ||
| 24 | const a = ET{ .SINT = -42 }; | |
| 25 | const b = ET{ .UINT = 42 }; | |
| 26 | var buf: [20]u8 = undefined; | |
| 27 | ||
| 28 | try expect((a.print(buf[0..]) catch unreachable) == 3); | |
| 29 | try expect(mem.eql(u8, buf[0..3], "-42")); | |
| 30 | ||
| 31 | try expect((b.print(buf[0..]) catch unreachable) == 2); | |
| 32 | try expect(mem.eql(u8, buf[0..2], "42")); | |
| 33 | } |