diff --git a/lib/compiler/aro/aro/Diagnostics.zig b/lib/compiler/aro/aro/Diagnostics.zig index 86b371b504..b59553b597 100644 --- a/lib/compiler/aro/aro/Diagnostics.zig +++ b/lib/compiler/aro/aro/Diagnostics.zig @@ -470,7 +470,7 @@ pub fn renderMessage(comp: *Compilation, m: anytype, msg: Message) void { } }.f; printRt(m, prop.msg, .{"{f}"}, .{ - std.fmt.Formatter([]const u8, f){ .data = msg.extra.normalized }, + std.fmt.Alt([]const u8, f){ .data = msg.extra.normalized }, }); }, .none, .offset => m.write(prop.msg), diff --git a/lib/compiler/resinator/errors.zig b/lib/compiler/resinator/errors.zig index 3db809322b..1d9cbf4c5b 100644 --- a/lib/compiler/resinator/errors.zig +++ b/lib/compiler/resinator/errors.zig @@ -433,7 +433,7 @@ pub const ErrorDetails = struct { code_page: SupportedCodePage, }; - fn fmtToken(self: ErrorDetails, source: []const u8) std.fmt.Formatter(TokenFormatContext, formatToken) { + fn fmtToken(self: ErrorDetails, source: []const u8) std.fmt.Alt(TokenFormatContext, formatToken) { return .{ .data = .{ .token = self.token, .code_page = self.code_page, diff --git a/lib/compiler/resinator/res.zig b/lib/compiler/resinator/res.zig index 570e8d5ea2..882a7b8d51 100644 --- a/lib/compiler/resinator/res.zig +++ b/lib/compiler/resinator/res.zig @@ -465,7 +465,7 @@ pub const NameOrOrdinal = union(enum) { } } - pub fn fmtResourceType(type_value: NameOrOrdinal) std.fmt.Formatter(NameOrOrdinal, formatResourceType) { + pub fn fmtResourceType(type_value: NameOrOrdinal) std.fmt.Alt(NameOrOrdinal, formatResourceType) { return .{ .data = type_value }; } }; diff --git a/lib/docs/wasm/markdown/renderer.zig b/lib/docs/wasm/markdown/renderer.zig index 13e3795b9a..91fd7129d5 100644 --- a/lib/docs/wasm/markdown/renderer.zig +++ b/lib/docs/wasm/markdown/renderer.zig @@ -231,7 +231,7 @@ pub fn renderInlineNodeText( } } -pub fn fmtHtml(bytes: []const u8) std.fmt.Formatter([]const u8, formatHtml) { +pub fn fmtHtml(bytes: []const u8) std.fmt.Alt([]const u8, formatHtml) { return .{ .data = bytes }; } diff --git a/lib/std/Build/Cache/Path.zig b/lib/std/Build/Cache/Path.zig index 335c1dc23e..bf16fc6814 100644 --- a/lib/std/Build/Cache/Path.zig +++ b/lib/std/Build/Cache/Path.zig @@ -147,7 +147,7 @@ pub fn toStringZ(p: Path, allocator: Allocator) Allocator.Error![:0]u8 { return std.fmt.allocPrintSentinel(allocator, "{f}", .{p}, 0); } -pub fn fmtEscapeString(path: Path) std.fmt.Formatter(Path, formatEscapeString) { +pub fn fmtEscapeString(path: Path) std.fmt.Alt(Path, formatEscapeString) { return .{ .data = path }; } @@ -162,7 +162,7 @@ pub fn formatEscapeString(path: Path, writer: *std.Io.Writer) std.Io.Writer.Erro } /// Deprecated, use double quoted escape to print paths. -pub fn fmtEscapeChar(path: Path) std.fmt.Formatter(Path, formatEscapeChar) { +pub fn fmtEscapeChar(path: Path) std.fmt.Alt(Path, formatEscapeChar) { return .{ .data = path }; } diff --git a/lib/std/Build/Step/CheckObject.zig b/lib/std/Build/Step/CheckObject.zig index 4a2efde407..9dfe65829a 100644 --- a/lib/std/Build/Step/CheckObject.zig +++ b/lib/std/Build/Step/CheckObject.zig @@ -595,7 +595,7 @@ fn make(step: *Step, make_options: Step.MakeOptions) !void { // we either format message string with escaped codes, or not to aid debugging // the failed test. const fmtMessageString = struct { - fn fmtMessageString(kind: Check.Kind, msg: []const u8) std.fmt.Formatter(Ctx, formatMessageString) { + fn fmtMessageString(kind: Check.Kind, msg: []const u8) std.fmt.Alt(Ctx, formatMessageString) { return .{ .data = .{ .kind = kind, .msg = msg, @@ -2281,7 +2281,7 @@ const ElfDumper = struct { return mem.sliceTo(@as([*:0]const u8, @ptrCast(strtab.ptr + off)), 0); } - fn fmtShType(sh_type: u32) std.fmt.Formatter(u32, formatShType) { + fn fmtShType(sh_type: u32) std.fmt.Alt(u32, formatShType) { return .{ .data = sh_type }; } @@ -2321,7 +2321,7 @@ const ElfDumper = struct { try writer.writeAll(name); } - fn fmtPhType(ph_type: u32) std.fmt.Formatter(u32, formatPhType) { + fn fmtPhType(ph_type: u32) std.fmt.Alt(u32, formatPhType) { return .{ .data = ph_type }; } diff --git a/lib/std/Build/Step/Run.zig b/lib/std/Build/Step/Run.zig index 78cf08dd43..09e75f4c8b 100644 --- a/lib/std/Build/Step/Run.zig +++ b/lib/std/Build/Step/Run.zig @@ -1025,7 +1025,7 @@ fn formatTerm(term: ?std.process.Child.Term, w: *std.Io.Writer) std.Io.Writer.Er try w.writeAll("exited with any code"); } } -fn fmtTerm(term: ?std.process.Child.Term) std.fmt.Formatter(?std.process.Child.Term, formatTerm) { +fn fmtTerm(term: ?std.process.Child.Term) std.fmt.Alt(?std.process.Child.Term, formatTerm) { return .{ .data = term }; } diff --git a/lib/std/Uri.zig b/lib/std/Uri.zig index 7244c9595b..54e0f6a4f2 100644 --- a/lib/std/Uri.zig +++ b/lib/std/Uri.zig @@ -359,7 +359,7 @@ pub const Format = struct { } }; -pub fn fmt(uri: *const Uri, flags: Format.Flags) std.fmt.Formatter(Format, Format.default) { +pub fn fmt(uri: *const Uri, flags: Format.Flags) std.fmt.Alt(Format, Format.default) { return .{ .data = .{ .uri = uri, .flags = flags } }; } diff --git a/lib/std/ascii.zig b/lib/std/ascii.zig index e2e6c1c6fa..48116a7230 100644 --- a/lib/std/ascii.zig +++ b/lib/std/ascii.zig @@ -464,7 +464,7 @@ pub const HexEscape = struct { }; /// Replaces non-ASCII bytes with hex escapes. -pub fn hexEscape(bytes: []const u8, case: std.fmt.Case) std.fmt.Formatter(HexEscape, HexEscape.format) { +pub fn hexEscape(bytes: []const u8, case: std.fmt.Case) std.fmt.Alt(HexEscape, HexEscape.format) { return .{ .data = .{ .bytes = bytes, .charset = switch (case) { .lower => HexEscape.lower_charset, .upper => HexEscape.upper_charset, diff --git a/lib/std/fmt.zig b/lib/std/fmt.zig index bee3eb9dfc..a346d68a4f 100644 --- a/lib/std/fmt.zig +++ b/lib/std/fmt.zig @@ -28,9 +28,6 @@ pub const Case = enum { lower, upper }; const default_alignment = .right; const default_fill_char = ' '; -/// Deprecated in favor of `Options`. -pub const FormatOptions = Options; - pub const Options = struct { precision: ?usize = null, width: ?usize = null, @@ -77,14 +74,6 @@ pub const Number = struct { }; }; -/// Deprecated in favor of `Writer.print`. -pub fn format(writer: anytype, comptime fmt: []const u8, args: anytype) !void { - var adapter = writer.adaptToNewApi(&.{}); - return adapter.new_interface.print(fmt, args) catch |err| switch (err) { - error.WriteFailed => return adapter.err.?, - }; -} - pub const Placeholder = struct { specifier_arg: []const u8, fill: u8, @@ -274,9 +263,6 @@ pub fn digits2(value: u8) [2]u8 { } } -/// Deprecated in favor of `Alt`. -pub const Formatter = Alt; - /// Creates a type suitable for instantiating and passing to a "{f}" placeholder. pub fn Alt( comptime Data: type, @@ -294,7 +280,7 @@ pub fn Alt( pub fn alt( context: anytype, comptime func_name: @TypeOf(.enum_literal), -) Formatter(@TypeOf(context), @field(@TypeOf(context), @tagName(func_name))) { +) Alt(@TypeOf(context), @field(@TypeOf(context), @tagName(func_name))) { return .{ .data = context }; } @@ -607,7 +593,7 @@ pub const BufPrintError = error{ NoSpaceLeft, }; -/// Print a Formatter string into `buf`. Returns a slice of the bytes printed. +/// Print a format string into `buf`. Returns a slice of the bytes printed. pub fn bufPrint(buf: []u8, comptime fmt: []const u8, args: anytype) BufPrintError![]u8 { var w: Writer = .fixed(buf); w.print(fmt, args) catch |err| switch (err) { diff --git a/lib/std/fs/path.zig b/lib/std/fs/path.zig index b63269abf4..9f5ed323f1 100644 --- a/lib/std/fs/path.zig +++ b/lib/std/fs/path.zig @@ -146,7 +146,7 @@ pub fn joinZ(allocator: Allocator, paths: []const []const u8) ![:0]u8 { return out[0 .. out.len - 1 :0]; } -pub fn fmtJoin(paths: []const []const u8) std.fmt.Formatter([]const []const u8, formatJoin) { +pub fn fmtJoin(paths: []const []const u8) std.fmt.Alt([]const []const u8, formatJoin) { return .{ .data = paths }; } diff --git a/lib/std/unicode.zig b/lib/std/unicode.zig index a248e983e4..7fbf1094ba 100644 --- a/lib/std/unicode.zig +++ b/lib/std/unicode.zig @@ -893,7 +893,7 @@ fn formatUtf8(utf8: []const u8, writer: *std.Io.Writer) std.Io.Writer.Error!void /// Ill-formed UTF-8 byte sequences are replaced by the replacement character (U+FFFD) /// according to "U+FFFD Substitution of Maximal Subparts" from Chapter 3 of /// the Unicode standard, and as specified by https://encoding.spec.whatwg.org/#utf-8-decoder -pub fn fmtUtf8(utf8: []const u8) std.fmt.Formatter([]const u8, formatUtf8) { +pub fn fmtUtf8(utf8: []const u8) std.fmt.Alt([]const u8, formatUtf8) { return .{ .data = utf8 }; } @@ -1483,7 +1483,7 @@ fn formatUtf16Le(utf16le: []const u16, writer: *std.Io.Writer) std.Io.Writer.Err /// Return a Formatter for a (potentially ill-formed) UTF-16 LE string, /// which will be converted to UTF-8 during formatting. /// Unpaired surrogates are replaced by the replacement character (U+FFFD). -pub fn fmtUtf16Le(utf16le: []const u16) std.fmt.Formatter([]const u16, formatUtf16Le) { +pub fn fmtUtf16Le(utf16le: []const u16) std.fmt.Alt([]const u16, formatUtf16Le) { return .{ .data = utf16le }; } diff --git a/lib/std/zig.zig b/lib/std/zig.zig index 8dc3e6ced7..c8eea995cd 100644 --- a/lib/std/zig.zig +++ b/lib/std/zig.zig @@ -462,12 +462,12 @@ pub const FormatId = struct { }; /// Return a formatter for escaping a double quoted Zig string. -pub fn fmtString(bytes: []const u8) std.fmt.Formatter([]const u8, stringEscape) { +pub fn fmtString(bytes: []const u8) std.fmt.Alt([]const u8, stringEscape) { return .{ .data = bytes }; } /// Return a formatter for escaping a single quoted Zig string. -pub fn fmtChar(c: u21) std.fmt.Formatter(u21, charEscape) { +pub fn fmtChar(c: u21) std.fmt.Alt(u21, charEscape) { return .{ .data = c }; } diff --git a/lib/std/zig/llvm/Builder.zig b/lib/std/zig/llvm/Builder.zig index a4b9d981b2..4afb0b8734 100644 --- a/lib/std/zig/llvm/Builder.zig +++ b/lib/std/zig/llvm/Builder.zig @@ -111,7 +111,7 @@ pub const String = enum(u32) { return printEscapedString(string_slice, quote_behavior, w); } - pub fn fmt(self: String, builder: *const Builder) std.fmt.Formatter(FormatData, format) { + pub fn fmt(self: String, builder: *const Builder) std.fmt.Alt(FormatData, format) { return .{ .data = .{ .string = self, .builder = builder, @@ -119,7 +119,7 @@ pub const String = enum(u32) { } }; } - pub fn fmtQ(self: String, builder: *const Builder) std.fmt.Formatter(FormatData, format) { + pub fn fmtQ(self: String, builder: *const Builder) std.fmt.Alt(FormatData, format) { return .{ .data = .{ .string = self, .builder = builder, @@ -127,7 +127,7 @@ pub const String = enum(u32) { } }; } - pub fn fmtRaw(self: String, builder: *const Builder) std.fmt.Formatter(FormatData, format) { + pub fn fmtRaw(self: String, builder: *const Builder) std.fmt.Alt(FormatData, format) { return .{ .data = .{ .string = self, .builder = builder, @@ -846,7 +846,7 @@ pub const Type = enum(u32) { }, } } - pub fn fmt(self: Type, builder: *const Builder, mode: FormatData.Mode) std.fmt.Formatter(FormatData, format) { + pub fn fmt(self: Type, builder: *const Builder, mode: FormatData.Mode) std.fmt.Alt(FormatData, format) { return .{ .data = .{ .type = self, .builder = builder, .mode = mode } }; } @@ -1325,7 +1325,7 @@ pub const Attribute = union(Kind) { .none => unreachable, } } - pub fn fmt(self: Index, builder: *const Builder, mode: FormatData.mode) std.fmt.Formatter(FormatData, format) { + pub fn fmt(self: Index, builder: *const Builder, mode: FormatData.mode) std.fmt.Alt(FormatData, format) { return .{ .data = .{ .attribute_index = self, .builder = builder, .mode = mode } }; } @@ -1609,7 +1609,7 @@ pub const Attributes = enum(u32) { .flags = data.flags, }, w); } - pub fn fmt(self: Attributes, builder: *const Builder, flags: FormatData.Flags) std.fmt.Formatter(FormatData, format) { + pub fn fmt(self: Attributes, builder: *const Builder, flags: FormatData.Flags) std.fmt.Alt(FormatData, format) { return .{ .data = .{ .attributes = self, .builder = builder, .flags = flags } }; } }; @@ -1803,7 +1803,7 @@ pub const Linkage = enum(u4) { fn formatOptional(data: ?Linkage, w: *Writer) Writer.Error!void { if (data) |linkage| try w.print(" {s}", .{@tagName(linkage)}); } - pub fn fmtOptional(self: ?Linkage) std.fmt.Formatter(?Linkage, formatOptional) { + pub fn fmtOptional(self: ?Linkage) std.fmt.Alt(?Linkage, formatOptional) { return .{ .data = self }; } }; @@ -2208,7 +2208,7 @@ pub const StrtabString = enum(u32) { self: StrtabString, builder: *const Builder, quote_behavior: ?QuoteBehavior, - ) std.fmt.Formatter(FormatData, format) { + ) std.fmt.Alt(FormatData, format) { return .{ .data = .{ .string = self, .builder = builder, @@ -2387,7 +2387,7 @@ pub const Global = struct { data.global.unwrap(data.builder).name(data.builder).fmt(data.builder, .quote_unless_valid_identifier), }); } - pub fn fmt(self: Index, builder: *const Builder) std.fmt.Formatter(FormatData, format) { + pub fn fmt(self: Index, builder: *const Builder) std.fmt.Alt(FormatData, format) { return .{ .data = .{ .global = self, .builder = builder } }; } @@ -4852,7 +4852,7 @@ pub const Function = struct { function: Function.Index, builder: *Builder, flags: FormatFlags, - ) std.fmt.Formatter(FormatData, format) { + ) std.fmt.Alt(FormatData, format) { return .{ .data = .{ .instruction = self, .function = function, @@ -7790,7 +7790,7 @@ pub const Constant = enum(u32) { .global => |global| try w.print("{f}", .{global.fmt(data.builder)}), } } - pub fn fmt(self: Constant, builder: *Builder, flags: FormatFlags) std.fmt.Formatter(FormatData, format) { + pub fn fmt(self: Constant, builder: *Builder, flags: FormatFlags) std.fmt.Alt(FormatData, format) { return .{ .data = .{ .constant = self, .builder = builder, @@ -7868,7 +7868,7 @@ pub const Value = enum(u32) { .metadata => unreachable, } } - pub fn fmt(self: Value, function: Function.Index, builder: *Builder, flags: FormatFlags) std.fmt.Formatter(FormatData, format) { + pub fn fmt(self: Value, function: Function.Index, builder: *Builder, flags: FormatFlags) std.fmt.Alt(FormatData, format) { return .{ .data = .{ .value = self, .function = function, .builder = builder, .flags = flags } }; } }; @@ -7902,7 +7902,7 @@ pub const MetadataString = enum(u32) { fn format(data: FormatData, w: *Writer) Writer.Error!void { try printEscapedString(data.metadata_string.slice(data.builder), .always_quote, w); } - fn fmt(self: MetadataString, builder: *const Builder) std.fmt.Formatter(FormatData, format) { + fn fmt(self: MetadataString, builder: *const Builder) std.fmt.Alt(FormatData, format) { return .{ .data = .{ .metadata_string = self, .builder = builder } }; } }; @@ -8411,7 +8411,7 @@ pub const Metadata = enum(u32) { inline fn fmt(formatter: *Formatter, prefix: []const u8, node: anytype, special: ?FormatFlags) switch (@TypeOf(node)) { Metadata => Allocator.Error, else => error{}, - }!std.fmt.Formatter(FormatData, format) { + }!std.fmt.Alt(FormatData, format) { const Node = @TypeOf(node); const MaybeNode = switch (@typeInfo(Node)) { .optional => Node, @@ -8456,7 +8456,7 @@ pub const Metadata = enum(u32) { prefix: []const u8, value: Value, function: Function.Index, - ) Allocator.Error!std.fmt.Formatter(FormatData, format) { + ) Allocator.Error!std.fmt.Alt(FormatData, format) { return .{ .data = .{ .formatter = formatter, .prefix = prefix, @@ -8539,7 +8539,7 @@ pub const Metadata = enum(u32) { fmt_str = fmt_str ++ "("; inline for (fields[2..], names) |*field, name| { fmt_str = fmt_str ++ "{[" ++ name ++ "]f}"; - const T = std.fmt.Formatter(FormatData, format); + const T = std.fmt.Alt(FormatData, format); field.* = .{ .name = name, .type = T, diff --git a/lib/std/zig/string_literal.zig b/lib/std/zig/string_literal.zig index 391764c925..3699636c79 100644 --- a/lib/std/zig/string_literal.zig +++ b/lib/std/zig/string_literal.zig @@ -87,7 +87,7 @@ pub const Error = union(enum) { } } - pub fn fmt(self: @This(), raw_string: []const u8) std.fmt.Formatter(FormatMessage, formatMessage) { + pub fn fmt(self: @This(), raw_string: []const u8) std.fmt.Alt(FormatMessage, formatMessage) { return .{ .data = .{ .err = self, .raw_string = raw_string, diff --git a/src/Compilation.zig b/src/Compilation.zig index 7e485aca46..85c4f49bf6 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -6465,7 +6465,7 @@ fn updateWin32Resource(comp: *Compilation, win32_resource: *Win32Resource, win32 }; } - pub fn fmtRcEscape(bytes: []const u8) std.fmt.Formatter([]const u8, formatRcEscape) { + pub fn fmtRcEscape(bytes: []const u8) std.fmt.Alt([]const u8, formatRcEscape) { return .{ .data = bytes }; } }.fmtRcEscape; diff --git a/src/InternPool.zig b/src/InternPool.zig index fd8515263c..9965497742 100644 --- a/src/InternPool.zig +++ b/src/InternPool.zig @@ -1904,11 +1904,11 @@ pub const NullTerminatedString = enum(u32) { } } - pub fn fmt(string: NullTerminatedString, ip: *const InternPool) std.fmt.Formatter(FormatData, format) { + pub fn fmt(string: NullTerminatedString, ip: *const InternPool) std.fmt.Alt(FormatData, format) { return .{ .data = .{ .string = string, .ip = ip, .id = false } }; } - pub fn fmtId(string: NullTerminatedString, ip: *const InternPool) std.fmt.Formatter(FormatData, format) { + pub fn fmtId(string: NullTerminatedString, ip: *const InternPool) std.fmt.Alt(FormatData, format) { return .{ .data = .{ .string = string, .ip = ip, .id = true } }; } diff --git a/src/Type.zig b/src/Type.zig index d1685fe5a6..3cdd48c3f3 100644 --- a/src/Type.zig +++ b/src/Type.zig @@ -127,7 +127,7 @@ pub fn format(ty: Type, writer: *std.Io.Writer) !void { @compileError("do not format types directly; use either ty.fmtDebug() or ty.fmt()"); } -pub const Formatter = std.fmt.Formatter(Format, Format.default); +pub const Formatter = std.fmt.Alt(Format, Format.default); pub fn fmt(ty: Type, pt: Zcu.PerThread) Formatter { return .{ .data = .{ @@ -145,7 +145,7 @@ const Format = struct { } }; -pub fn fmtDebug(ty: Type) std.fmt.Formatter(Type, dump) { +pub fn fmtDebug(ty: Type) std.fmt.Alt(Type, dump) { return .{ .data = ty }; } diff --git a/src/Value.zig b/src/Value.zig index 0badae7cee..e0afc6ca4e 100644 --- a/src/Value.zig +++ b/src/Value.zig @@ -27,11 +27,11 @@ pub fn dump(start_val: Value, w: std.Io.Writer) std.Io.Writer.Error!void { try w.print("(interned: {})", .{start_val.toIntern()}); } -pub fn fmtDebug(val: Value) std.fmt.Formatter(Value, dump) { +pub fn fmtDebug(val: Value) std.fmt.Alt(Value, dump) { return .{ .data = val }; } -pub fn fmtValue(val: Value, pt: Zcu.PerThread) std.fmt.Formatter(print_value.FormatContext, print_value.format) { +pub fn fmtValue(val: Value, pt: Zcu.PerThread) std.fmt.Alt(print_value.FormatContext, print_value.format) { return .{ .data = .{ .val = val, .pt = pt, @@ -40,7 +40,7 @@ pub fn fmtValue(val: Value, pt: Zcu.PerThread) std.fmt.Formatter(print_value.For } }; } -pub fn fmtValueSema(val: Value, pt: Zcu.PerThread, sema: *Sema) std.fmt.Formatter(print_value.FormatContext, print_value.formatSema) { +pub fn fmtValueSema(val: Value, pt: Zcu.PerThread, sema: *Sema) std.fmt.Alt(print_value.FormatContext, print_value.formatSema) { return .{ .data = .{ .val = val, .pt = pt, @@ -49,7 +49,7 @@ pub fn fmtValueSema(val: Value, pt: Zcu.PerThread, sema: *Sema) std.fmt.Formatte } }; } -pub fn fmtValueSemaFull(ctx: print_value.FormatContext) std.fmt.Formatter(print_value.FormatContext, print_value.formatSema) { +pub fn fmtValueSemaFull(ctx: print_value.FormatContext) std.fmt.Alt(print_value.FormatContext, print_value.formatSema) { return .{ .data = ctx }; } diff --git a/src/Zcu.zig b/src/Zcu.zig index 3f5cf1d5fd..d86f422b98 100644 --- a/src/Zcu.zig +++ b/src/Zcu.zig @@ -4306,10 +4306,10 @@ pub fn navFileScope(zcu: *Zcu, nav: InternPool.Nav.Index) *File { return zcu.fileByIndex(zcu.navFileScopeIndex(nav)); } -pub fn fmtAnalUnit(zcu: *Zcu, unit: AnalUnit) std.fmt.Formatter(FormatAnalUnit, formatAnalUnit) { +pub fn fmtAnalUnit(zcu: *Zcu, unit: AnalUnit) std.fmt.Alt(FormatAnalUnit, formatAnalUnit) { return .{ .data = .{ .unit = unit, .zcu = zcu } }; } -pub fn fmtDependee(zcu: *Zcu, d: InternPool.Dependee) std.fmt.Formatter(FormatDependee, formatDependee) { +pub fn fmtDependee(zcu: *Zcu, d: InternPool.Dependee) std.fmt.Alt(FormatDependee, formatDependee) { return .{ .data = .{ .dependee = d, .zcu = zcu } }; } diff --git a/src/arch/riscv64/CodeGen.zig b/src/arch/riscv64/CodeGen.zig index c5aa5f4201..7b13cfc90d 100644 --- a/src/arch/riscv64/CodeGen.zig +++ b/src/arch/riscv64/CodeGen.zig @@ -972,7 +972,7 @@ fn formatWipMir(data: FormatWipMirData, writer: *std.Io.Writer) std.Io.Writer.Er first = false; } } -fn fmtWipMir(func: *Func, inst: Mir.Inst.Index) std.fmt.Formatter(FormatWipMirData, formatWipMir) { +fn fmtWipMir(func: *Func, inst: Mir.Inst.Index) std.fmt.Alt(FormatWipMirData, formatWipMir) { return .{ .data = .{ .func = func, .inst = inst } }; } @@ -983,7 +983,7 @@ const FormatNavData = struct { fn formatNav(data: FormatNavData, writer: *std.Io.Writer) std.Io.Writer.Error!void { try writer.print("{f}", .{data.ip.getNav(data.nav_index).fqn.fmt(data.ip)}); } -fn fmtNav(nav_index: InternPool.Nav.Index, ip: *const InternPool) std.fmt.Formatter(FormatNavData, formatNav) { +fn fmtNav(nav_index: InternPool.Nav.Index, ip: *const InternPool) std.fmt.Alt(FormatNavData, formatNav) { return .{ .data = .{ .ip = ip, .nav_index = nav_index, @@ -1001,7 +1001,7 @@ fn formatAir(data: FormatAirData, writer: *std.Io.Writer) std.Io.Writer.Error!vo _ = writer; @panic("unimplemented"); } -fn fmtAir(func: *Func, inst: Air.Inst.Index) std.fmt.Formatter(FormatAirData, formatAir) { +fn fmtAir(func: *Func, inst: Air.Inst.Index) std.fmt.Alt(FormatAirData, formatAir) { return .{ .data = .{ .func = func, .inst = inst } }; } @@ -1012,7 +1012,7 @@ fn formatTracking(data: FormatTrackingData, writer: *std.Io.Writer) std.Io.Write var it = data.func.inst_tracking.iterator(); while (it.next()) |entry| try writer.print("\n%{d} = {f}", .{ entry.key_ptr.*, entry.value_ptr.* }); } -fn fmtTracking(func: *Func) std.fmt.Formatter(FormatTrackingData, formatTracking) { +fn fmtTracking(func: *Func) std.fmt.Alt(FormatTrackingData, formatTracking) { return .{ .data = .{ .func = func } }; } diff --git a/src/arch/x86_64/CodeGen.zig b/src/arch/x86_64/CodeGen.zig index e975fbf8bb..1d3792d785 100644 --- a/src/arch/x86_64/CodeGen.zig +++ b/src/arch/x86_64/CodeGen.zig @@ -1091,7 +1091,7 @@ const FormatNavData = struct { fn formatNav(data: FormatNavData, w: *Writer) Writer.Error!void { try w.print("{f}", .{data.ip.getNav(data.nav_index).fqn.fmt(data.ip)}); } -fn fmtNav(nav_index: InternPool.Nav.Index, ip: *const InternPool) std.fmt.Formatter(FormatNavData, formatNav) { +fn fmtNav(nav_index: InternPool.Nav.Index, ip: *const InternPool) std.fmt.Alt(FormatNavData, formatNav) { return .{ .data = .{ .ip = ip, .nav_index = nav_index, @@ -1105,7 +1105,7 @@ const FormatAirData = struct { fn formatAir(data: FormatAirData, w: *Writer) Writer.Error!void { data.self.air.writeInst(w, data.inst, data.self.pt, data.self.liveness); } -fn fmtAir(self: *CodeGen, inst: Air.Inst.Index) std.fmt.Formatter(FormatAirData, formatAir) { +fn fmtAir(self: *CodeGen, inst: Air.Inst.Index) std.fmt.Alt(FormatAirData, formatAir) { return .{ .data = .{ .self = self, .inst = inst } }; } @@ -1197,7 +1197,7 @@ fn formatWipMir(data: FormatWipMirData, w: *Writer) Writer.Error!void { } } } -fn fmtWipMir(self: *CodeGen, inst: Mir.Inst.Index) std.fmt.Formatter(FormatWipMirData, formatWipMir) { +fn fmtWipMir(self: *CodeGen, inst: Mir.Inst.Index) std.fmt.Alt(FormatWipMirData, formatWipMir) { return .{ .data = .{ .self = self, .inst = inst } }; } @@ -1208,7 +1208,7 @@ fn formatTracking(data: FormatTrackingData, w: *Writer) Writer.Error!void { var it = data.self.inst_tracking.iterator(); while (it.next()) |entry| try w.print("\n{f} = {f}", .{ entry.key_ptr.*, entry.value_ptr.* }); } -fn fmtTracking(self: *CodeGen) std.fmt.Formatter(FormatTrackingData, formatTracking) { +fn fmtTracking(self: *CodeGen) std.fmt.Alt(FormatTrackingData, formatTracking) { return .{ .data = .{ .self = self } }; } diff --git a/src/arch/x86_64/encoder.zig b/src/arch/x86_64/encoder.zig index 55ec7d49b6..03ff7134f6 100644 --- a/src/arch/x86_64/encoder.zig +++ b/src/arch/x86_64/encoder.zig @@ -301,7 +301,7 @@ pub const Instruction = struct { } }; - pub fn fmt(op: Operand, enc_op: Encoding.Op) std.fmt.Formatter(Format, Format.default) { + pub fn fmt(op: Operand, enc_op: Encoding.Op) std.fmt.Alt(Format, Format.default) { return .{ .data = .{ .op = op, .enc_op = enc_op } }; } }; diff --git a/src/codegen/c.zig b/src/codegen/c.zig index b2ecac5d10..4468fa600f 100644 --- a/src/codegen/c.zig +++ b/src/codegen/c.zig @@ -371,11 +371,11 @@ fn formatIdentOptions(ident: []const u8, w: *Writer, solo: bool) Writer.Error!vo } } -pub fn fmtIdentSolo(ident: []const u8) std.fmt.Formatter([]const u8, formatIdentSolo) { +pub fn fmtIdentSolo(ident: []const u8) std.fmt.Alt([]const u8, formatIdentSolo) { return .{ .data = ident }; } -pub fn fmtIdentUnsolo(ident: []const u8) std.fmt.Formatter([]const u8, formatIdentUnsolo) { +pub fn fmtIdentUnsolo(ident: []const u8) std.fmt.Alt([]const u8, formatIdentUnsolo) { return .{ .data = ident }; } @@ -394,7 +394,7 @@ pub fn fmtCTypePoolString( ctype_pool_string: CType.Pool.String, ctype_pool: *const CType.Pool, solo: bool, -) std.fmt.Formatter(CTypePoolStringFormatData, formatCTypePoolString) { +) std.fmt.Alt(CTypePoolStringFormatData, formatCTypePoolString) { return .{ .data = .{ .ctype_pool_string = ctype_pool_string, .ctype_pool = ctype_pool, @@ -610,11 +610,11 @@ pub const Function = struct { return f.object.dg.renderIntCast(w, dest_ty, .{ .c_value = .{ .f = f, .value = src, .v = v } }, src_ty, location); } - fn fmtIntLiteralDec(f: *Function, val: Value) !std.fmt.Formatter(FormatIntLiteralContext, formatIntLiteral) { + fn fmtIntLiteralDec(f: *Function, val: Value) !std.fmt.Alt(FormatIntLiteralContext, formatIntLiteral) { return f.object.dg.fmtIntLiteralDec(val, .Other); } - fn fmtIntLiteralHex(f: *Function, val: Value) !std.fmt.Formatter(FormatIntLiteralContext, formatIntLiteral) { + fn fmtIntLiteralHex(f: *Function, val: Value) !std.fmt.Alt(FormatIntLiteralContext, formatIntLiteral) { return f.object.dg.fmtIntLiteralHex(val, .Other); } @@ -1919,7 +1919,7 @@ pub const DeclGen = struct { kind: CType.Kind, name: union(enum) { nav: InternPool.Nav.Index, - fmt_ctype_pool_string: std.fmt.Formatter(CTypePoolStringFormatData, formatCTypePoolString), + fmt_ctype_pool_string: std.fmt.Alt(CTypePoolStringFormatData, formatCTypePoolString), @"export": struct { main_name: InternPool.NullTerminatedString, extern_name: InternPool.NullTerminatedString, @@ -2439,7 +2439,7 @@ pub const DeclGen = struct { loc: ValueRenderLocation, base: u8, case: std.fmt.Case, - ) !std.fmt.Formatter(FormatIntLiteralContext, formatIntLiteral) { + ) !std.fmt.Alt(FormatIntLiteralContext, formatIntLiteral) { const zcu = dg.pt.zcu; const kind = loc.toCTypeKind(); const ty = val.typeOf(zcu); @@ -2461,7 +2461,7 @@ pub const DeclGen = struct { dg: *DeclGen, val: Value, loc: ValueRenderLocation, - ) !std.fmt.Formatter(FormatIntLiteralContext, formatIntLiteral) { + ) !std.fmt.Alt(FormatIntLiteralContext, formatIntLiteral) { return fmtIntLiteral(dg, val, loc, 10, .lower); } @@ -2469,7 +2469,7 @@ pub const DeclGen = struct { dg: *DeclGen, val: Value, loc: ValueRenderLocation, - ) !std.fmt.Formatter(FormatIntLiteralContext, formatIntLiteral) { + ) !std.fmt.Alt(FormatIntLiteralContext, formatIntLiteral) { return fmtIntLiteral(dg, val, loc, 16, .lower); } }; @@ -8295,7 +8295,7 @@ fn formatStringLiteral(data: FormatStringContext, w: *Writer) Writer.Error!void try literal.end(); } -fn fmtStringLiteral(str: []const u8, sentinel: ?u8) std.fmt.Formatter(FormatStringContext, formatStringLiteral) { +fn fmtStringLiteral(str: []const u8, sentinel: ?u8) std.fmt.Alt(FormatStringContext, formatStringLiteral) { return .{ .data = .{ .str = str, .sentinel = sentinel } }; } diff --git a/src/codegen/c/Type.zig b/src/codegen/c/Type.zig index d270e1dc9c..fa4db36a0c 100644 --- a/src/codegen/c/Type.zig +++ b/src/codegen/c/Type.zig @@ -989,7 +989,7 @@ pub const Pool = struct { else try writer.print("f{d}", .{@intFromEnum(data.string.index)}); } - pub fn fmt(str: String, pool: *const Pool) std.fmt.Formatter(FormatData, format) { + pub fn fmt(str: String, pool: *const Pool) std.fmt.Alt(FormatData, format) { return .{ .data = .{ .string = str, .pool = pool } }; } diff --git a/src/link/Coff.zig b/src/link/Coff.zig index 4a3e201683..be9c4ff389 100644 --- a/src/link/Coff.zig +++ b/src/link/Coff.zig @@ -3053,7 +3053,7 @@ const ImportTable = struct { } }; - fn fmtDebug(itab: ImportTable, ctx: Context) fmt.Formatter(Format, Format.default) { + fn fmtDebug(itab: ImportTable, ctx: Context) fmt.Alt(Format, Format.default) { return .{ .data = .{ .itab = itab, .ctx = ctx } }; } diff --git a/src/link/Elf.zig b/src/link/Elf.zig index 3a7d9d7c94..1c3d7c4267 100644 --- a/src/link/Elf.zig +++ b/src/link/Elf.zig @@ -3862,7 +3862,7 @@ const FormatShdr = struct { shdr: elf.Elf64_Shdr, }; -fn fmtShdr(self: *Elf, shdr: elf.Elf64_Shdr) std.fmt.Formatter(FormatShdr, formatShdr) { +fn fmtShdr(self: *Elf, shdr: elf.Elf64_Shdr) std.fmt.Alt(FormatShdr, formatShdr) { return .{ .data = .{ .shdr = shdr, .elf_file = self, @@ -3879,7 +3879,7 @@ fn formatShdr(ctx: FormatShdr, writer: *std.Io.Writer) std.Io.Writer.Error!void }); } -pub fn fmtShdrFlags(sh_flags: u64) std.fmt.Formatter(u64, formatShdrFlags) { +pub fn fmtShdrFlags(sh_flags: u64) std.fmt.Alt(u64, formatShdrFlags) { return .{ .data = sh_flags }; } @@ -3933,7 +3933,7 @@ const FormatPhdr = struct { phdr: elf.Elf64_Phdr, }; -fn fmtPhdr(self: *Elf, phdr: elf.Elf64_Phdr) std.fmt.Formatter(FormatPhdr, formatPhdr) { +fn fmtPhdr(self: *Elf, phdr: elf.Elf64_Phdr) std.fmt.Alt(FormatPhdr, formatPhdr) { return .{ .data = .{ .phdr = phdr, .elf_file = self, @@ -3967,7 +3967,7 @@ fn formatPhdr(ctx: FormatPhdr, writer: *std.Io.Writer) std.Io.Writer.Error!void }); } -pub fn dumpState(self: *Elf) std.fmt.Formatter(*Elf, fmtDumpState) { +pub fn dumpState(self: *Elf) std.fmt.Alt(*Elf, fmtDumpState) { return .{ .data = self }; } diff --git a/src/link/Elf/Archive.zig b/src/link/Elf/Archive.zig index 775a63cd74..0157b18fb4 100644 --- a/src/link/Elf/Archive.zig +++ b/src/link/Elf/Archive.zig @@ -215,7 +215,7 @@ pub const ArSymtab = struct { } }; - pub fn fmt(ar: ArSymtab, elf_file: *Elf) std.fmt.Formatter(Format, Format.default) { + pub fn fmt(ar: ArSymtab, elf_file: *Elf) std.fmt.Alt(Format, Format.default) { return .{ .data = .{ .ar = ar, .elf_file = elf_file, diff --git a/src/link/Elf/Atom.zig b/src/link/Elf/Atom.zig index 6bfaddea97..f59d2f4a24 100644 --- a/src/link/Elf/Atom.zig +++ b/src/link/Elf/Atom.zig @@ -894,7 +894,7 @@ pub fn setExtra(atom: Atom, extras: Extra, elf_file: *Elf) void { atom.file(elf_file).?.setAtomExtra(atom.extra_index, extras); } -pub fn fmt(atom: Atom, elf_file: *Elf) std.fmt.Formatter(Format, Format.default) { +pub fn fmt(atom: Atom, elf_file: *Elf) std.fmt.Alt(Format, Format.default) { return .{ .data = .{ .atom = atom, .elf_file = elf_file, diff --git a/src/link/Elf/AtomList.zig b/src/link/Elf/AtomList.zig index 4cb5b3f6f5..4eb1cbdbbd 100644 --- a/src/link/Elf/AtomList.zig +++ b/src/link/Elf/AtomList.zig @@ -187,7 +187,7 @@ const Format = struct { } }; -pub fn fmt(atom_list: AtomList, elf_file: *Elf) std.fmt.Formatter(Format, Format.default) { +pub fn fmt(atom_list: AtomList, elf_file: *Elf) std.fmt.Alt(Format, Format.default) { return .{ .data = .{ .atom_list = atom_list, .elf_file = elf_file } }; } diff --git a/src/link/Elf/LinkerDefined.zig b/src/link/Elf/LinkerDefined.zig index c1b3e257a4..b74406c368 100644 --- a/src/link/Elf/LinkerDefined.zig +++ b/src/link/Elf/LinkerDefined.zig @@ -437,7 +437,7 @@ pub fn setSymbolExtra(self: *LinkerDefined, index: u32, extra: Symbol.Extra) voi } } -pub fn fmtSymtab(self: *LinkerDefined, elf_file: *Elf) std.fmt.Formatter(Format, Format.symtab) { +pub fn fmtSymtab(self: *LinkerDefined, elf_file: *Elf) std.fmt.Alt(Format, Format.symtab) { return .{ .data = .{ .self = self, .elf_file = elf_file, diff --git a/src/link/Elf/Merge.zig b/src/link/Elf/Merge.zig index 95023055d9..340a2e7f67 100644 --- a/src/link/Elf/Merge.zig +++ b/src/link/Elf/Merge.zig @@ -157,7 +157,7 @@ pub const Section = struct { } }; - pub fn fmt(msec: Section, elf_file: *Elf) std.fmt.Formatter(Format, Format.default) { + pub fn fmt(msec: Section, elf_file: *Elf) std.fmt.Alt(Format, Format.default) { return .{ .data = .{ .msec = msec, .elf_file = elf_file, @@ -211,7 +211,7 @@ pub const Subsection = struct { return msec.bytes.items[msub.string_index..][0..msub.size]; } - pub fn fmt(msub: Subsection, elf_file: *Elf) std.fmt.Formatter(Format, Format.default) { + pub fn fmt(msub: Subsection, elf_file: *Elf) std.fmt.Alt(Format, Format.default) { return .{ .data = .{ .msub = msub, .elf_file = elf_file, diff --git a/src/link/Elf/Object.zig b/src/link/Elf/Object.zig index 52ae848345..eddb5c90dd 100644 --- a/src/link/Elf/Object.zig +++ b/src/link/Elf/Object.zig @@ -1431,7 +1431,7 @@ pub fn group(self: *Object, index: Elf.Group.Index) *Elf.Group { return &self.groups.items[index]; } -pub fn fmtSymtab(self: *Object, elf_file: *Elf) std.fmt.Formatter(Format, Format.symtab) { +pub fn fmtSymtab(self: *Object, elf_file: *Elf) std.fmt.Alt(Format, Format.symtab) { return .{ .data = .{ .object = self, .elf_file = elf_file, @@ -1504,35 +1504,35 @@ const Format = struct { } }; -pub fn fmtAtoms(self: *Object, elf_file: *Elf) std.fmt.Formatter(Format, Format.atoms) { +pub fn fmtAtoms(self: *Object, elf_file: *Elf) std.fmt.Alt(Format, Format.atoms) { return .{ .data = .{ .object = self, .elf_file = elf_file, } }; } -pub fn fmtCies(self: *Object, elf_file: *Elf) std.fmt.Formatter(Format, Format.cies) { +pub fn fmtCies(self: *Object, elf_file: *Elf) std.fmt.Alt(Format, Format.cies) { return .{ .data = .{ .object = self, .elf_file = elf_file, } }; } -pub fn fmtFdes(self: *Object, elf_file: *Elf) std.fmt.Formatter(Format, Format.fdes) { +pub fn fmtFdes(self: *Object, elf_file: *Elf) std.fmt.Alt(Format, Format.fdes) { return .{ .data = .{ .object = self, .elf_file = elf_file, } }; } -pub fn fmtGroups(self: *Object, elf_file: *Elf) std.fmt.Formatter(Format, Format.groups) { +pub fn fmtGroups(self: *Object, elf_file: *Elf) std.fmt.Alt(Format, Format.groups) { return .{ .data = .{ .object = self, .elf_file = elf_file, } }; } -pub fn fmtPath(self: Object) std.fmt.Formatter(Object, formatPath) { +pub fn fmtPath(self: Object) std.fmt.Alt(Object, formatPath) { return .{ .data = self }; } diff --git a/src/link/Elf/SharedObject.zig b/src/link/Elf/SharedObject.zig index 5be14b8a90..9ce8c53b2c 100644 --- a/src/link/Elf/SharedObject.zig +++ b/src/link/Elf/SharedObject.zig @@ -509,7 +509,7 @@ pub fn setSymbolExtra(self: *SharedObject, index: u32, extra: Symbol.Extra) void } } -pub fn fmtSymtab(self: SharedObject, elf_file: *Elf) std.fmt.Formatter(Format, Format.symtab) { +pub fn fmtSymtab(self: SharedObject, elf_file: *Elf) std.fmt.Alt(Format, Format.symtab) { return .{ .data = .{ .shared = self, .elf_file = elf_file, diff --git a/src/link/Elf/Symbol.zig b/src/link/Elf/Symbol.zig index 3f99221842..e3974d0eac 100644 --- a/src/link/Elf/Symbol.zig +++ b/src/link/Elf/Symbol.zig @@ -368,14 +368,14 @@ const Format = struct { } }; -pub fn fmtName(symbol: Symbol, elf_file: *Elf) std.fmt.Formatter(Format, Format.name) { +pub fn fmtName(symbol: Symbol, elf_file: *Elf) std.fmt.Alt(Format, Format.name) { return .{ .data = .{ .symbol = symbol, .elf_file = elf_file, } }; } -pub fn fmt(symbol: Symbol, elf_file: *Elf) std.fmt.Formatter(Format, Format.default) { +pub fn fmt(symbol: Symbol, elf_file: *Elf) std.fmt.Alt(Format, Format.default) { return .{ .data = .{ .symbol = symbol, .elf_file = elf_file, diff --git a/src/link/Elf/Thunk.zig b/src/link/Elf/Thunk.zig index 8012c53a54..1700bb8276 100644 --- a/src/link/Elf/Thunk.zig +++ b/src/link/Elf/Thunk.zig @@ -65,7 +65,7 @@ fn trampolineSize(cpu_arch: std.Target.Cpu.Arch) usize { }; } -pub fn fmt(thunk: Thunk, elf_file: *Elf) std.fmt.Formatter(Format, Format.default) { +pub fn fmt(thunk: Thunk, elf_file: *Elf) std.fmt.Alt(Format, Format.default) { return .{ .data = .{ .thunk = thunk, .elf_file = elf_file, diff --git a/src/link/Elf/ZigObject.zig b/src/link/Elf/ZigObject.zig index 82b2b91481..93a78ea012 100644 --- a/src/link/Elf/ZigObject.zig +++ b/src/link/Elf/ZigObject.zig @@ -2225,14 +2225,14 @@ const Format = struct { } }; -pub fn fmtSymtab(self: *ZigObject, elf_file: *Elf) std.fmt.Formatter(Format, Format.symtab) { +pub fn fmtSymtab(self: *ZigObject, elf_file: *Elf) std.fmt.Alt(Format, Format.symtab) { return .{ .data = .{ .self = self, .elf_file = elf_file, } }; } -pub fn fmtAtoms(self: *ZigObject, elf_file: *Elf) std.fmt.Formatter(Format, Format.atoms) { +pub fn fmtAtoms(self: *ZigObject, elf_file: *Elf) std.fmt.Alt(Format, Format.atoms) { return .{ .data = .{ .self = self, .elf_file = elf_file, diff --git a/src/link/Elf/eh_frame.zig b/src/link/Elf/eh_frame.zig index a0f07df79b..9276692f13 100644 --- a/src/link/Elf/eh_frame.zig +++ b/src/link/Elf/eh_frame.zig @@ -47,7 +47,7 @@ pub const Fde = struct { return object.relocs.items[fde.rel_index..][0..fde.rel_num]; } - pub fn fmt(fde: Fde, elf_file: *Elf) std.fmt.Formatter(Format, Format.default) { + pub fn fmt(fde: Fde, elf_file: *Elf) std.fmt.Alt(Format, Format.default) { return .{ .data = .{ .fde = fde, .elf_file = elf_file, @@ -130,7 +130,7 @@ pub const Cie = struct { return true; } - pub fn fmt(cie: Cie, elf_file: *Elf) std.fmt.Formatter(Format, Format.default) { + pub fn fmt(cie: Cie, elf_file: *Elf) std.fmt.Alt(Format, Format.default) { return .{ .data = .{ .cie = cie, .elf_file = elf_file, diff --git a/src/link/Elf/file.zig b/src/link/Elf/file.zig index 25c1b1192b..50f5159d18 100644 --- a/src/link/Elf/file.zig +++ b/src/link/Elf/file.zig @@ -10,7 +10,7 @@ pub const File = union(enum) { }; } - pub fn fmtPath(file: File) std.fmt.Formatter(File, formatPath) { + pub fn fmtPath(file: File) std.fmt.Alt(File, formatPath) { return .{ .data = file }; } diff --git a/src/link/Elf/relocation.zig b/src/link/Elf/relocation.zig index cffaffb954..021bfee209 100644 --- a/src/link/Elf/relocation.zig +++ b/src/link/Elf/relocation.zig @@ -153,7 +153,7 @@ const FormatRelocTypeCtx = struct { cpu_arch: std.Target.Cpu.Arch, }; -pub fn fmtRelocType(r_type: u32, cpu_arch: std.Target.Cpu.Arch) std.fmt.Formatter(FormatRelocTypeCtx, formatRelocType) { +pub fn fmtRelocType(r_type: u32, cpu_arch: std.Target.Cpu.Arch) std.fmt.Alt(FormatRelocTypeCtx, formatRelocType) { return .{ .data = .{ .r_type = r_type, .cpu_arch = cpu_arch, diff --git a/src/link/Elf/synthetic_sections.zig b/src/link/Elf/synthetic_sections.zig index 33522c0555..2ff7302410 100644 --- a/src/link/Elf/synthetic_sections.zig +++ b/src/link/Elf/synthetic_sections.zig @@ -622,7 +622,7 @@ pub const GotSection = struct { } }; - pub fn fmt(got: GotSection, elf_file: *Elf) std.fmt.Formatter(Format, Format.default) { + pub fn fmt(got: GotSection, elf_file: *Elf) std.fmt.Alt(Format, Format.default) { return .{ .data = .{ .got = got, .elf_file = elf_file } }; } }; @@ -758,7 +758,7 @@ pub const PltSection = struct { } }; - pub fn fmt(plt: PltSection, elf_file: *Elf) std.fmt.Formatter(Format, Format.default) { + pub fn fmt(plt: PltSection, elf_file: *Elf) std.fmt.Alt(Format, Format.default) { return .{ .data = .{ .plt = plt, .elf_file = elf_file } }; } diff --git a/src/link/MachO.zig b/src/link/MachO.zig index d8c4a20767..9205d51981 100644 --- a/src/link/MachO.zig +++ b/src/link/MachO.zig @@ -3906,7 +3906,7 @@ pub fn ptraceDetach(self: *MachO, pid: std.posix.pid_t) !void { self.hot_state.mach_task = null; } -pub fn dumpState(self: *MachO) std.fmt.Formatter(*MachO, fmtDumpState) { +pub fn dumpState(self: *MachO) std.fmt.Alt(*MachO, fmtDumpState) { return .{ .data = self }; } @@ -3964,7 +3964,7 @@ fn fmtDumpState(self: *MachO, w: *Writer) Writer.Error!void { try w.print("segments\n{f}\n", .{self.fmtSegments()}); } -fn fmtSections(self: *MachO) std.fmt.Formatter(*MachO, formatSections) { +fn fmtSections(self: *MachO) std.fmt.Alt(*MachO, formatSections) { return .{ .data = self }; } @@ -3981,7 +3981,7 @@ fn formatSections(self: *MachO, w: *Writer) Writer.Error!void { } } -fn fmtSegments(self: *MachO) std.fmt.Formatter(*MachO, formatSegments) { +fn fmtSegments(self: *MachO) std.fmt.Alt(*MachO, formatSegments) { return .{ .data = self }; } @@ -3994,7 +3994,7 @@ fn formatSegments(self: *MachO, w: *Writer) Writer.Error!void { } } -pub fn fmtSectType(tt: u8) std.fmt.Formatter(u8, formatSectType) { +pub fn fmtSectType(tt: u8) std.fmt.Alt(u8, formatSectType) { return .{ .data = tt }; } @@ -4257,7 +4257,7 @@ pub const Platform = struct { return false; } - pub fn fmtTarget(plat: Platform, cpu_arch: std.Target.Cpu.Arch) std.fmt.Formatter(Format, Format.target) { + pub fn fmtTarget(plat: Platform, cpu_arch: std.Target.Cpu.Arch) std.fmt.Alt(Format, Format.target) { return .{ .data = .{ .platform = plat, .cpu_arch = cpu_arch } }; } diff --git a/src/link/MachO/Archive.zig b/src/link/MachO/Archive.zig index 1c7e285eb7..007e630bfb 100644 --- a/src/link/MachO/Archive.zig +++ b/src/link/MachO/Archive.zig @@ -225,7 +225,7 @@ pub const ArSymtab = struct { } }; - pub fn fmt(ar: ArSymtab, macho_file: *MachO) std.fmt.Formatter(PrintFormat, PrintFormat.default) { + pub fn fmt(ar: ArSymtab, macho_file: *MachO) std.fmt.Alt(PrintFormat, PrintFormat.default) { return .{ .data = .{ .ar = ar, .macho_file = macho_file } }; } diff --git a/src/link/MachO/Atom.zig b/src/link/MachO/Atom.zig index c5d29c7ff5..278d28d270 100644 --- a/src/link/MachO/Atom.zig +++ b/src/link/MachO/Atom.zig @@ -1073,7 +1073,7 @@ pub fn writeRelocs(self: Atom, macho_file: *MachO, code: []u8, buffer: []macho.r assert(i == buffer.len); } -pub fn fmt(atom: Atom, macho_file: *MachO) std.fmt.Formatter(Format, Format.print) { +pub fn fmt(atom: Atom, macho_file: *MachO) std.fmt.Alt(Format, Format.print) { return .{ .data = .{ .atom = atom, .macho_file = macho_file, diff --git a/src/link/MachO/Dylib.zig b/src/link/MachO/Dylib.zig index bf48addc1e..526ca2d086 100644 --- a/src/link/MachO/Dylib.zig +++ b/src/link/MachO/Dylib.zig @@ -667,7 +667,7 @@ pub fn setSymbolExtra(self: *Dylib, index: u32, extra: Symbol.Extra) void { } } -pub fn fmtSymtab(self: *Dylib, macho_file: *MachO) std.fmt.Formatter(Format, Format.symtab) { +pub fn fmtSymtab(self: *Dylib, macho_file: *MachO) std.fmt.Alt(Format, Format.symtab) { return .{ .data = .{ .dylib = self, .macho_file = macho_file, diff --git a/src/link/MachO/InternalObject.zig b/src/link/MachO/InternalObject.zig index f8623dbf28..00721c470b 100644 --- a/src/link/MachO/InternalObject.zig +++ b/src/link/MachO/InternalObject.zig @@ -864,14 +864,14 @@ const Format = struct { } }; -pub fn fmtAtoms(self: *InternalObject, macho_file: *MachO) std.fmt.Formatter(Format, Format.atoms) { +pub fn fmtAtoms(self: *InternalObject, macho_file: *MachO) std.fmt.Alt(Format, Format.atoms) { return .{ .data = .{ .self = self, .macho_file = macho_file, } }; } -pub fn fmtSymtab(self: *InternalObject, macho_file: *MachO) std.fmt.Formatter(Format, Format.symtab) { +pub fn fmtSymtab(self: *InternalObject, macho_file: *MachO) std.fmt.Alt(Format, Format.symtab) { return .{ .data = .{ .self = self, .macho_file = macho_file, diff --git a/src/link/MachO/Object.zig b/src/link/MachO/Object.zig index 9dcaca76c8..6752c751b2 100644 --- a/src/link/MachO/Object.zig +++ b/src/link/MachO/Object.zig @@ -2578,42 +2578,42 @@ const Format = struct { } }; -pub fn fmtAtoms(self: *Object, macho_file: *MachO) std.fmt.Formatter(Format, Format.atoms) { +pub fn fmtAtoms(self: *Object, macho_file: *MachO) std.fmt.Alt(Format, Format.atoms) { return .{ .data = .{ .object = self, .macho_file = macho_file, } }; } -pub fn fmtCies(self: *Object, macho_file: *MachO) std.fmt.Formatter(Format, Format.cies) { +pub fn fmtCies(self: *Object, macho_file: *MachO) std.fmt.Alt(Format, Format.cies) { return .{ .data = .{ .object = self, .macho_file = macho_file, } }; } -pub fn fmtFdes(self: *Object, macho_file: *MachO) std.fmt.Formatter(Format, Format.fdes) { +pub fn fmtFdes(self: *Object, macho_file: *MachO) std.fmt.Alt(Format, Format.fdes) { return .{ .data = .{ .object = self, .macho_file = macho_file, } }; } -pub fn fmtUnwindRecords(self: *Object, macho_file: *MachO) std.fmt.Formatter(Format, Format.unwindRecords) { +pub fn fmtUnwindRecords(self: *Object, macho_file: *MachO) std.fmt.Alt(Format, Format.unwindRecords) { return .{ .data = .{ .object = self, .macho_file = macho_file, } }; } -pub fn fmtSymtab(self: *Object, macho_file: *MachO) std.fmt.Formatter(Format, Format.symtab) { +pub fn fmtSymtab(self: *Object, macho_file: *MachO) std.fmt.Alt(Format, Format.symtab) { return .{ .data = .{ .object = self, .macho_file = macho_file, } }; } -pub fn fmtPath(self: Object) std.fmt.Formatter(Object, formatPath) { +pub fn fmtPath(self: Object) std.fmt.Alt(Object, formatPath) { return .{ .data = self }; } @@ -2694,7 +2694,7 @@ const StabFile = struct { } }; - pub fn fmt(stab: Stab, object: Object) std.fmt.Formatter(Stab.Format, Stab.Format.default) { + pub fn fmt(stab: Stab, object: Object) std.fmt.Alt(Stab.Format, Stab.Format.default) { return .{ .data = .{ .stab = stab, .object = object } }; } }; diff --git a/src/link/MachO/Relocation.zig b/src/link/MachO/Relocation.zig index 6ce8fa1bb2..20edce1bbe 100644 --- a/src/link/MachO/Relocation.zig +++ b/src/link/MachO/Relocation.zig @@ -70,7 +70,7 @@ pub fn lessThan(ctx: void, lhs: Relocation, rhs: Relocation) bool { return lhs.offset < rhs.offset; } -pub fn fmtPretty(rel: Relocation, cpu_arch: std.Target.Cpu.Arch) std.fmt.Formatter(Format, Format.pretty) { +pub fn fmtPretty(rel: Relocation, cpu_arch: std.Target.Cpu.Arch) std.fmt.Alt(Format, Format.pretty) { return .{ .data = .{ .relocation = rel, .arch = cpu_arch } }; } diff --git a/src/link/MachO/Symbol.zig b/src/link/MachO/Symbol.zig index ab7d128d9e..582768ad10 100644 --- a/src/link/MachO/Symbol.zig +++ b/src/link/MachO/Symbol.zig @@ -286,7 +286,7 @@ pub fn setOutputSym(symbol: Symbol, macho_file: *MachO, out: *macho.nlist_64) vo } } -pub fn fmt(symbol: Symbol, macho_file: *MachO) std.fmt.Formatter(Format, Format.default) { +pub fn fmt(symbol: Symbol, macho_file: *MachO) std.fmt.Alt(Format, Format.default) { return .{ .data = .{ .symbol = symbol, .macho_file = macho_file, diff --git a/src/link/MachO/Thunk.zig b/src/link/MachO/Thunk.zig index 44d2904540..4588a7f0e0 100644 --- a/src/link/MachO/Thunk.zig +++ b/src/link/MachO/Thunk.zig @@ -63,7 +63,7 @@ pub fn writeSymtab(thunk: Thunk, macho_file: *MachO, ctx: anytype) void { } } -pub fn fmt(thunk: Thunk, macho_file: *MachO) std.fmt.Formatter(Format, Format.default) { +pub fn fmt(thunk: Thunk, macho_file: *MachO) std.fmt.Alt(Format, Format.default) { return .{ .data = .{ .thunk = thunk, .macho_file = macho_file, diff --git a/src/link/MachO/UnwindInfo.zig b/src/link/MachO/UnwindInfo.zig index 9b7185743b..5dff5450f5 100644 --- a/src/link/MachO/UnwindInfo.zig +++ b/src/link/MachO/UnwindInfo.zig @@ -509,7 +509,7 @@ pub const Record = struct { return lsda.getAddress(macho_file) + rec.lsda_offset; } - pub fn fmt(rec: Record, macho_file: *MachO) std.fmt.Formatter(Format, Format.default) { + pub fn fmt(rec: Record, macho_file: *MachO) std.fmt.Alt(Format, Format.default) { return .{ .data = .{ .rec = rec, .macho_file = macho_file, @@ -603,7 +603,7 @@ const Page = struct { } }; - fn fmt(page: Page, info: UnwindInfo) std.fmt.Formatter(Format, Format.default) { + fn fmt(page: Page, info: UnwindInfo) std.fmt.Alt(Format, Format.default) { return .{ .data = .{ .page = page, .info = info, diff --git a/src/link/MachO/ZigObject.zig b/src/link/MachO/ZigObject.zig index e8d5cce3e2..b1fc6528d5 100644 --- a/src/link/MachO/ZigObject.zig +++ b/src/link/MachO/ZigObject.zig @@ -1680,7 +1680,7 @@ pub fn asFile(self: *ZigObject) File { return .{ .zig_object = self }; } -pub fn fmtSymtab(self: *ZigObject, macho_file: *MachO) std.fmt.Formatter(Format, Format.symtab) { +pub fn fmtSymtab(self: *ZigObject, macho_file: *MachO) std.fmt.Alt(Format, Format.symtab) { return .{ .data = .{ .self = self, .macho_file = macho_file, @@ -1717,7 +1717,7 @@ const Format = struct { } }; -pub fn fmtAtoms(self: *ZigObject, macho_file: *MachO) std.fmt.Formatter(Format, Format.atoms) { +pub fn fmtAtoms(self: *ZigObject, macho_file: *MachO) std.fmt.Alt(Format, Format.atoms) { return .{ .data = .{ .self = self, .macho_file = macho_file, diff --git a/src/link/MachO/eh_frame.zig b/src/link/MachO/eh_frame.zig index bd13e50180..86edf97396 100644 --- a/src/link/MachO/eh_frame.zig +++ b/src/link/MachO/eh_frame.zig @@ -79,7 +79,7 @@ pub const Cie = struct { return true; } - pub fn fmt(cie: Cie, macho_file: *MachO) std.fmt.Formatter(Format, Format.default) { + pub fn fmt(cie: Cie, macho_file: *MachO) std.fmt.Alt(Format, Format.default) { return .{ .data = .{ .cie = cie, .macho_file = macho_file, @@ -208,7 +208,7 @@ pub const Fde = struct { return fde.getObject(macho_file).getAtom(fde.lsda); } - pub fn fmt(fde: Fde, macho_file: *MachO) std.fmt.Formatter(Format, Format.default) { + pub fn fmt(fde: Fde, macho_file: *MachO) std.fmt.Alt(Format, Format.default) { return .{ .data = .{ .fde = fde, .macho_file = macho_file, diff --git a/src/link/MachO/file.zig b/src/link/MachO/file.zig index 2b0f8e644b..577e9374a6 100644 --- a/src/link/MachO/file.zig +++ b/src/link/MachO/file.zig @@ -10,7 +10,7 @@ pub const File = union(enum) { }; } - pub fn fmtPath(file: File) std.fmt.Formatter(File, formatPath) { + pub fn fmtPath(file: File) std.fmt.Alt(File, formatPath) { return .{ .data = file }; } diff --git a/src/link/MachO/synthetic.zig b/src/link/MachO/synthetic.zig index 6761a4a340..79fbd8d3d0 100644 --- a/src/link/MachO/synthetic.zig +++ b/src/link/MachO/synthetic.zig @@ -55,7 +55,7 @@ pub const GotSection = struct { } }; - pub fn fmt(got: GotSection, macho_file: *MachO) std.fmt.Formatter(Format, Format.print) { + pub fn fmt(got: GotSection, macho_file: *MachO) std.fmt.Alt(Format, Format.print) { return .{ .data = .{ .got = got, .macho_file = macho_file } }; } }; @@ -120,7 +120,7 @@ pub const StubsSection = struct { } } - pub fn fmt(stubs: StubsSection, macho_file: *MachO) std.fmt.Formatter(Format, Format.print) { + pub fn fmt(stubs: StubsSection, macho_file: *MachO) std.fmt.Alt(Format, Format.print) { return .{ .data = .{ .stubs = stubs, .macho_file = macho_file } }; } @@ -337,7 +337,7 @@ pub const TlvPtrSection = struct { } } - pub fn fmt(tlv: TlvPtrSection, macho_file: *MachO) std.fmt.Formatter(Format, Format.print) { + pub fn fmt(tlv: TlvPtrSection, macho_file: *MachO) std.fmt.Alt(Format, Format.print) { return .{ .data = .{ .tlv = tlv, .macho_file = macho_file } }; } @@ -452,7 +452,7 @@ pub const ObjcStubsSection = struct { } } - pub fn fmt(objc: ObjcStubsSection, macho_file: *MachO) std.fmt.Formatter(Format, Format.print) { + pub fn fmt(objc: ObjcStubsSection, macho_file: *MachO) std.fmt.Alt(Format, Format.print) { return .{ .data = .{ .objc = objc, .macho_file = macho_file } }; }