Commit d5c97fded5
Changed files (22)
lib
compiler
aro
std
zig
llvm
src
codegen
link
lib/compiler/aro/aro/Diagnostics.zig
@@ -328,8 +328,8 @@ pub fn render(comp: *Compilation, config: std.io.tty.Config) void {
defer m.deinit();
renderMessages(comp, &m);
}
-pub fn defaultMsgWriter(config: std.io.tty.Config) MsgWriter {
- return MsgWriter.init(config);
+pub fn defaultMsgWriter(config: std.io.tty.Config, buffer: []u8) MsgWriter {
+ return MsgWriter.init(config, buffer);
}
pub fn renderMessages(comp: *Compilation, m: anytype) void {
@@ -529,16 +529,15 @@ const MsgWriter = struct {
config: std.io.tty.Config,
fn init(config: std.io.tty.Config, buffer: []u8) MsgWriter {
- std.debug.lockStdErr();
return .{
- .w = std.fs.stderr().writer(buffer),
+ .w = std.debug.lockStderrWriter(buffer),
.config = config,
};
}
pub fn deinit(m: *MsgWriter) void {
- m.w.flush() catch {};
- std.debug.unlockStdErr();
+ std.debug.unlockStderrWriter();
+ m.* = undefined;
}
pub fn print(m: *MsgWriter, comptime fmt: []const u8, args: anytype) void {
lib/compiler/aro/aro/Value.zig
@@ -961,7 +961,7 @@ pub fn print(v: Value, ty: Type, comp: *const Compilation, w: anytype) @TypeOf(w
switch (key) {
.null => return w.writeAll("nullptr_t"),
.int => |repr| switch (repr) {
- inline else => |x| return w.print("{d}", .{x}),
+ inline else => |x| return w.print("{fd}", .{x}),
},
.float => |repr| switch (repr) {
.f16 => |x| return w.print("{d}", .{@round(@as(f64, @floatCast(x)) * 1000) / 1000}),
lib/std/io/Writer.zig
@@ -1981,21 +1981,15 @@ pub fn Hashed(comptime Hasher: type) type {
.hasher = hasher,
.writer = .{
.buffer = buffer,
- .vtable = &.{@This().drain},
+ .vtable = &.{ .drain = @This().drain },
},
};
}
fn drain(w: *Writer, data: []const []const u8, splat: usize) Error!usize {
const this: *@This() = @alignCast(@fieldParentPtr("writer", w));
- if (data.len == 0) {
- const buf = w.buffered();
- try this.out.writeAll(buf);
- this.hasher.update(buf);
- w.end = 0;
- return buf.len;
- }
- const aux_n = try this.out.writeSplatAux(w.buffered(), data, splat);
+ const aux = w.buffered();
+ const aux_n = try this.out.writeSplatHeader(aux, data, splat);
if (aux_n < w.end) {
this.hasher.update(w.buffer[0..aux_n]);
const remaining = w.buffer[aux_n..w.end];
@@ -2003,29 +1997,20 @@ pub fn Hashed(comptime Hasher: type) type {
w.end = remaining.len;
return 0;
}
- this.hasher.update(w.buffered());
+ this.hasher.update(aux);
const n = aux_n - w.end;
w.end = 0;
var remaining: usize = n;
- const short_data = data[0 .. data.len - @intFromBool(splat == 0)];
- for (short_data) |slice| {
- if (remaining < slice.len) {
+ for (data[0 .. data.len - 1]) |slice| {
+ if (remaining <= slice.len) {
this.hasher.update(slice[0..remaining]);
return n;
- } else {
- remaining -= slice.len;
- this.hasher.update(slice);
}
+ remaining -= slice.len;
+ this.hasher.update(slice);
}
- const remaining_splat = switch (splat) {
- 0, 1 => {
- assert(remaining == 0);
- return n;
- },
- else => splat - 1,
- };
const pattern = data[data.len - 1];
- assert(remaining == remaining_splat * pattern.len);
+ assert(remaining == splat * pattern.len);
switch (pattern.len) {
0 => {
assert(remaining == 0);
lib/std/zig/llvm/Builder.zig
@@ -1262,7 +1262,7 @@ pub const Attribute = union(Kind) {
try w.writeByte(')');
},
.alignstack => |alignment| {
- try w.print(" {s}", .{attribute});
+ try w.print(" {f}", .{attribute});
const alignment_bytes = alignment.toByteUnits() orelse return;
switch (data.mode) {
.pound => try w.print("({d})", .{alignment_bytes}),
src/codegen/c.zig
@@ -1563,7 +1563,7 @@ pub const DeclGen = struct {
.payload => {
try writer.writeByte('{');
if (field_ty.hasRuntimeBits(zcu)) {
- try writer.print(" .{ } = ", .{fmtIdentSolo(field_name.toSlice(ip))});
+ try writer.print(" .{f} = ", .{fmtIdentSolo(field_name.toSlice(ip))});
try dg.renderValue(
writer,
Value.fromInterned(un.val),
@@ -1667,7 +1667,7 @@ pub const DeclGen = struct {
try writer.writeAll("{(");
const ptr_ty = ty.slicePtrFieldType(zcu);
try dg.renderType(writer, ptr_ty);
- return writer.print("){f}, {0x}}}", .{
+ return writer.print("){f}, {0fx}}}", .{
try dg.fmtIntLiteralHex(.undef_usize, .Other),
});
},
@@ -1972,17 +1972,17 @@ pub const DeclGen = struct {
const is_mangled = isMangledIdent(extern_name, true);
const is_export = @"export".extern_name != @"export".main_name;
if (is_mangled and is_export) {
- try w.print(" zig_mangled_export({ }, {s}, {s})", .{
+ try w.print(" zig_mangled_export({f}, {f}, {f})", .{
fmtIdentSolo(extern_name),
fmtStringLiteral(extern_name, null),
fmtStringLiteral(@"export".main_name.toSlice(ip), null),
});
} else if (is_mangled) {
- try w.print(" zig_mangled({ }, {s})", .{
+ try w.print(" zig_mangled({f}, {f})", .{
fmtIdentSolo(extern_name), fmtStringLiteral(extern_name, null),
});
} else if (is_export) {
- try w.print(" zig_export({s}, {s})", .{
+ try w.print(" zig_export({f}, {f})", .{
fmtStringLiteral(@"export".main_name.toSlice(ip), null),
fmtStringLiteral(extern_name, null),
});
@@ -2210,7 +2210,7 @@ pub const DeclGen = struct {
.new_local, .local => |i| try w.print("t{d}", .{i}),
.constant => |uav| try renderUavName(w, uav),
.nav => |nav| try dg.renderNavName(w, nav),
- .identifier => |ident| try w.print("{ }", .{fmtIdentSolo(ident)}),
+ .identifier => |ident| try w.print("{f}", .{fmtIdentSolo(ident)}),
else => unreachable,
}
}
@@ -2227,8 +2227,8 @@ pub const DeclGen = struct {
try dg.renderNavName(w, nav);
},
.undef => |ty| try dg.renderUndefValue(w, ty, .Other),
- .identifier => |ident| try w.print("{ }", .{fmtIdentSolo(ident)}),
- .payload_identifier => |ident| try w.print("{ }.{ }", .{
+ .identifier => |ident| try w.print("{f}", .{fmtIdentSolo(ident)}),
+ .payload_identifier => |ident| try w.print("{f}.{f}", .{
fmtIdentSolo("payload"),
fmtIdentSolo(ident),
}),
@@ -2257,8 +2257,8 @@ pub const DeclGen = struct {
},
.nav_ref => |nav| try dg.renderNavName(w, nav),
.undef => unreachable,
- .identifier => |ident| try w.print("(*{ })", .{fmtIdentSolo(ident)}),
- .payload_identifier => |ident| try w.print("(*{ }.{ })", .{
+ .identifier => |ident| try w.print("(*{f})", .{fmtIdentSolo(ident)}),
+ .payload_identifier => |ident| try w.print("(*{f}.{f})", .{
fmtIdentSolo("payload"),
fmtIdentSolo(ident),
}),
@@ -2345,7 +2345,7 @@ pub const DeclGen = struct {
const ip = &zcu.intern_pool;
const nav = ip.getNav(nav_index);
if (nav.getExtern(ip)) |@"extern"| {
- try writer.print("{ }", .{
+ try writer.print("{f}", .{
fmtIdentSolo(ip.getNav(@"extern".owner_nav).name.toSlice(ip)),
});
} else {
@@ -2790,7 +2790,7 @@ pub fn genTypeDecl(
pub fn genGlobalAsm(zcu: *Zcu, writer: anytype) !void {
for (zcu.global_assembly.values()) |asm_source| {
- try writer.print("__asm({s});\n", .{fmtStringLiteral(asm_source, null)});
+ try writer.print("__asm({f});\n", .{fmtStringLiteral(asm_source, null)});
}
}
@@ -3063,7 +3063,7 @@ fn genFunc(f: *Function) !void {
try fwd.writeAll(";\n");
if (nav.status.fully_resolved.@"linksection".toSlice(ip)) |s|
- try o.writer().print("zig_linksection_fn({s}) ", .{fmtStringLiteral(s, null)});
+ try o.writer().print("zig_linksection_fn({f}) ", .{fmtStringLiteral(s, null)});
try o.dg.renderFunctionSignature(
o.writer(),
nav_val,
@@ -3176,7 +3176,7 @@ pub fn genDecl(o: *Object) !void {
const w = o.writer();
if (variable.is_threadlocal and !o.dg.mod.single_threaded) try w.writeAll("zig_threadlocal ");
if (nav.status.fully_resolved.@"linksection".toSlice(&zcu.intern_pool)) |s|
- try w.print("zig_linksection({s}) ", .{fmtStringLiteral(s, null)});
+ try w.print("zig_linksection({f}) ", .{fmtStringLiteral(s, null)});
try o.dg.renderTypeAndName(
w,
nav_ty,
@@ -3217,7 +3217,7 @@ pub fn genDeclValue(
const w = o.writer();
if (@"linksection".toSlice(&zcu.intern_pool)) |s|
- try w.print("zig_linksection({s}) ", .{fmtStringLiteral(s, null)});
+ try w.print("zig_linksection({f}) ", .{fmtStringLiteral(s, null)});
try o.dg.renderTypeAndName(w, ty, decl_c_value, Const, alignment, .complete);
try w.writeAll(" = ");
try o.dg.renderValue(w, val, .StaticInitializer);
@@ -3236,7 +3236,7 @@ pub fn genExports(dg: *DeclGen, exported: Zcu.Exported, export_indices: []const
.uav => |uav| try DeclGen.renderUavName(fwd, Value.fromInterned(uav)),
}
try fwd.writeByte(' ');
- try fwd.print("{ }", .{fmtIdentSolo(main_name.toSlice(ip))});
+ try fwd.print("{f}", .{fmtIdentSolo(main_name.toSlice(ip))});
try fwd.writeByte('\n');
const exported_val = exported.getValue(zcu);
@@ -3266,7 +3266,7 @@ pub fn genExports(dg: *DeclGen, exported: Zcu.Exported, export_indices: []const
const @"export" = export_index.ptr(zcu);
try fwd.writeAll("zig_extern ");
if (@"export".opts.linkage == .weak) try fwd.writeAll("zig_weak_linkage ");
- if (@"export".opts.section.toSlice(ip)) |s| try fwd.print("zig_linksection({s}) ", .{
+ if (@"export".opts.section.toSlice(ip)) |s| try fwd.print("zig_linksection({f}) ", .{
fmtStringLiteral(s, null),
});
const extern_name = @"export".opts.name.toSlice(ip);
@@ -3281,17 +3281,17 @@ pub fn genExports(dg: *DeclGen, exported: Zcu.Exported, export_indices: []const
.complete,
);
if (is_mangled and is_export) {
- try fwd.print(" zig_mangled_export({ }, {s}, {s})", .{
+ try fwd.print(" zig_mangled_export({f}, {f}, {f})", .{
fmtIdentSolo(extern_name),
fmtStringLiteral(extern_name, null),
fmtStringLiteral(main_name.toSlice(ip), null),
});
} else if (is_mangled) {
- try fwd.print(" zig_mangled({ }, {s})", .{
+ try fwd.print(" zig_mangled({f}, {f})", .{
fmtIdentSolo(extern_name), fmtStringLiteral(extern_name, null),
});
} else if (is_export) {
- try fwd.print(" zig_export({s}, {s})", .{
+ try fwd.print(" zig_export({f}, {f})", .{
fmtStringLiteral(main_name.toSlice(ip), null),
fmtStringLiteral(extern_name, null),
});
@@ -4570,7 +4570,7 @@ fn airCmpLtErrorsLen(f: *Function, inst: Air.Inst.Index) !CValue {
try f.writeCValue(writer, local, .Other);
try writer.writeAll(" = ");
try f.writeCValue(writer, operand, .Other);
- try writer.print(" < sizeof({ }) / sizeof(*{0 });\n", .{fmtIdentSolo("zig_errorName")});
+ try writer.print(" < sizeof({f}) / sizeof(*{0f});\n", .{fmtIdentSolo("zig_errorName")});
return local;
}
@@ -5644,7 +5644,7 @@ fn airAsm(f: *Function, inst: Air.Inst.Index) !CValue {
try writer.writeAll("__asm");
if (is_volatile) try writer.writeAll(" volatile");
- try writer.print("({s}", .{fmtStringLiteral(fixed_asm_source[0..dst_i], null)});
+ try writer.print("({f}", .{fmtStringLiteral(fixed_asm_source[0..dst_i], null)});
}
extra_i = constraints_extra_begin;
@@ -5662,7 +5662,7 @@ fn airAsm(f: *Function, inst: Air.Inst.Index) !CValue {
try writer.writeByte(' ');
if (!mem.eql(u8, name, "_")) try writer.print("[{s}]", .{name});
const is_reg = constraint[1] == '{';
- try writer.print("{s}(", .{fmtStringLiteral(if (is_reg) "=r" else constraint, null)});
+ try writer.print("{f}(", .{fmtStringLiteral(if (is_reg) "=r" else constraint, null)});
if (is_reg) {
try f.writeCValue(writer, .{ .local = locals_index }, .Other);
locals_index += 1;
@@ -5688,7 +5688,7 @@ fn airAsm(f: *Function, inst: Air.Inst.Index) !CValue {
const is_reg = constraint[0] == '{';
const input_val = try f.resolveInst(input);
- try writer.print("{s}(", .{fmtStringLiteral(if (is_reg) "r" else constraint, null)});
+ try writer.print("{f}(", .{fmtStringLiteral(if (is_reg) "r" else constraint, null)});
try f.writeCValue(writer, if (asmInputNeedsLocal(f, constraint, input_val)) local: {
const input_local_idx = locals_index;
locals_index += 1;
@@ -5706,7 +5706,7 @@ fn airAsm(f: *Function, inst: Air.Inst.Index) !CValue {
if (clobber.len == 0) continue;
if (clobber_i > 0) try writer.writeByte(',');
- try writer.print(" {s}", .{fmtStringLiteral(clobber, null)});
+ try writer.print(" {f}", .{fmtStringLiteral(clobber, null)});
}
try writer.writeAll(");\n");
@@ -8160,7 +8160,7 @@ fn StringLiteral(comptime WriterType: type) type {
cur_len: u64 = 0,
counting_writer: std.io.CountingWriter(WriterType),
- pub const Error = WriterType.Error;
+ pub const Error = if (WriterType == *std.io.Writer) error{WriteFailed} else WriterType.Error;
const Self = @This();
src/link/Elf/Atom.zig
@@ -243,7 +243,7 @@ pub fn writeRelocs(self: Atom, elf_file: *Elf, out_relocs: *std.ArrayList(elf.El
},
}
- relocs_log.debug(" {s}: [{x} => {d}({s})] + {x}", .{
+ relocs_log.debug(" {f}: [{x} => {d}({s})] + {x}", .{
relocation.fmtRelocType(rel.r_type(), cpu_arch),
r_offset,
r_sym,
@@ -652,7 +652,7 @@ pub fn resolveRelocsAlloc(self: Atom, elf_file: *Elf, code: []u8) RelocError!voi
// Address of the dynamic thread pointer.
const DTP = elf_file.dtpAddress();
- relocs_log.debug(" {s}: {x}: [{x} => {x}] GOT({x}) ({s})", .{
+ relocs_log.debug(" {f}: {x}: [{x} => {x}] GOT({x}) ({s})", .{
relocation.fmtRelocType(rel.r_type(), cpu_arch),
r_offset,
P,
src/link/Elf/eh_frame.zig
@@ -276,7 +276,7 @@ fn resolveReloc(rec: anytype, sym: *const Symbol, rel: elf.Elf64_Rela, elf_file:
const S = math.cast(i64, sym.address(.{}, elf_file)) orelse return error.Overflow;
const A = rel.r_addend;
- relocs_log.debug(" {s}: {x}: [{x} => {x}] ({s})", .{
+ relocs_log.debug(" {f}: {x}: [{x} => {x}] ({s})", .{
relocation.fmtRelocType(rel.r_type(), cpu_arch),
offset,
P,
@@ -398,7 +398,7 @@ fn emitReloc(elf_file: *Elf, r_offset: u64, sym: *const Symbol, rel: elf.Elf64_R
},
}
- relocs_log.debug(" {s}: [{x} => {d}({s})] + {x}", .{
+ relocs_log.debug(" {f}: [{x} => {d}({s})] + {x}", .{
relocation.fmtRelocType(r_type, cpu_arch),
r_offset,
r_sym,
src/link/Elf/Object.zig
@@ -488,10 +488,7 @@ fn parseEhFrame(
if (cie.offset == cie_ptr) break @as(u32, @intCast(cie_index));
} else {
// TODO convert into an error
- log.debug("{s}: no matching CIE found for FDE at offset {x}", .{
- self.fmtPath(),
- fde.offset,
- });
+ log.debug("{f}: no matching CIE found for FDE at offset {x}", .{ self.fmtPath(), fde.offset });
continue;
};
fde.cie_index = cie_index;
@@ -582,7 +579,7 @@ pub fn scanRelocs(self: *Object, elf_file: *Elf, undefs: anytype) !void {
if (sym.flags.import) {
if (sym.type(elf_file) != elf.STT_FUNC)
// TODO convert into an error
- log.debug("{s}: {s}: CIE referencing external data reference", .{
+ log.debug("{f}: {s}: CIE referencing external data reference", .{
self.fmtPath(), sym.name(elf_file),
});
sym.flags.needs_plt = true;
@@ -1448,14 +1445,14 @@ const Format = struct {
const elf_file = f.elf_file;
try writer.writeAll(" locals\n");
for (object.locals()) |sym| {
- try writer.print(" {}\n", .{sym.fmt(elf_file)});
+ try writer.print(" {f}\n", .{sym.fmt(elf_file)});
}
try writer.writeAll(" globals\n");
for (object.globals(), 0..) |sym, i| {
const first_global = object.first_global.?;
const ref = object.resolveSymbol(@intCast(i + first_global), elf_file);
if (elf_file.symbol(ref)) |ref_sym| {
- try writer.print(" {}\n", .{ref_sym.fmt(elf_file)});
+ try writer.print(" {f}\n", .{ref_sym.fmt(elf_file)});
} else {
try writer.print(" {s} : unclaimed\n", .{sym.name(elf_file)});
}
@@ -1467,7 +1464,7 @@ const Format = struct {
try writer.writeAll(" atoms\n");
for (object.atoms_indexes.items) |atom_index| {
const atom_ptr = object.atom(atom_index) orelse continue;
- try writer.print(" {}\n", .{atom_ptr.fmt(f.elf_file)});
+ try writer.print(" {f}\n", .{atom_ptr.fmt(f.elf_file)});
}
}
@@ -1475,7 +1472,7 @@ const Format = struct {
const object = f.object;
try writer.writeAll(" cies\n");
for (object.cies.items, 0..) |cie, i| {
- try writer.print(" cie({d}) : {}\n", .{ i, cie.fmt(f.elf_file) });
+ try writer.print(" cie({d}) : {f}\n", .{ i, cie.fmt(f.elf_file) });
}
}
@@ -1483,7 +1480,7 @@ const Format = struct {
const object = f.object;
try writer.writeAll(" fdes\n");
for (object.fdes.items, 0..) |fde, i| {
- try writer.print(" fde({d}) : {}\n", .{ i, fde.fmt(f.elf_file) });
+ try writer.print(" fde({d}) : {f}\n", .{ i, fde.fmt(f.elf_file) });
}
}
src/link/Elf/synthetic_sections.zig
@@ -696,7 +696,7 @@ pub const PltSection = struct {
const r_sym: u64 = extra.dynamic;
const r_type = relocation.encode(.jump_slot, cpu_arch);
- relocs_log.debug(" {s}: [{x} => {d}({s})] + 0", .{
+ relocs_log.debug(" {f}: [{x} => {d}({s})] + 0", .{
relocation.fmtRelocType(r_type, cpu_arch),
r_offset,
r_sym,
src/link/Elf/ZigObject.zig
@@ -925,7 +925,7 @@ pub fn getNavVAddr(
const zcu = pt.zcu;
const ip = &zcu.intern_pool;
const nav = ip.getNav(nav_index);
- log.debug("getNavVAddr {}({d})", .{ nav.fqn.fmt(ip), nav_index });
+ log.debug("getNavVAddr {f}({d})", .{ nav.fqn.fmt(ip), nav_index });
const this_sym_index = if (nav.getExtern(ip)) |@"extern"| try self.getGlobalSymbol(
elf_file,
nav.name.toSlice(ip),
@@ -1268,7 +1268,7 @@ fn updateNavCode(
const ip = &zcu.intern_pool;
const nav = ip.getNav(nav_index);
- log.debug("updateNavCode {}({d})", .{ nav.fqn.fmt(ip), nav_index });
+ log.debug("updateNavCode {f}({d})", .{ nav.fqn.fmt(ip), nav_index });
const target = &zcu.navFileScope(nav_index).mod.?.resolved_target.result;
const required_alignment = switch (pt.navAlignment(nav_index)) {
@@ -1302,7 +1302,7 @@ fn updateNavCode(
self.allocateAtom(atom_ptr, true, elf_file) catch |err|
return elf_file.base.cgFail(nav_index, "failed to allocate atom: {s}", .{@errorName(err)});
- log.debug("growing {} from 0x{x} to 0x{x}", .{ nav.fqn.fmt(ip), old_vaddr, atom_ptr.value });
+ log.debug("growing {f} from 0x{x} to 0x{x}", .{ nav.fqn.fmt(ip), old_vaddr, atom_ptr.value });
if (old_vaddr != atom_ptr.value) {
sym.value = 0;
esym.st_value = 0;
@@ -1347,7 +1347,7 @@ fn updateNavCode(
const file_offset = atom_ptr.offset(elf_file);
elf_file.base.file.?.pwriteAll(code, file_offset) catch |err|
return elf_file.base.cgFail(nav_index, "failed to write to output file: {s}", .{@errorName(err)});
- log.debug("writing {} from 0x{x} to 0x{x}", .{ nav.fqn.fmt(ip), file_offset, file_offset + code.len });
+ log.debug("writing {f} from 0x{x} to 0x{x}", .{ nav.fqn.fmt(ip), file_offset, file_offset + code.len });
}
}
@@ -1365,7 +1365,7 @@ fn updateTlv(
const gpa = zcu.gpa;
const nav = ip.getNav(nav_index);
- log.debug("updateTlv {}({d})", .{ nav.fqn.fmt(ip), nav_index });
+ log.debug("updateTlv {f}({d})", .{ nav.fqn.fmt(ip), nav_index });
const required_alignment = pt.navAlignment(nav_index);
@@ -1424,7 +1424,7 @@ pub fn updateFunc(
const gpa = elf_file.base.comp.gpa;
const func = zcu.funcInfo(func_index);
- log.debug("updateFunc {}({d})", .{ ip.getNav(func.owner_nav).fqn.fmt(ip), func.owner_nav });
+ log.debug("updateFunc {f}({d})", .{ ip.getNav(func.owner_nav).fqn.fmt(ip), func.owner_nav });
const sym_index = try self.getOrCreateMetadataForNav(zcu, func.owner_nav);
self.atom(self.symbol(sym_index).ref.index).?.freeRelocs(self);
@@ -1447,7 +1447,7 @@ pub fn updateFunc(
const code = code_buffer.items;
const shndx = try self.getNavShdrIndex(elf_file, zcu, func.owner_nav, sym_index, code);
- log.debug("setting shdr({x},{s}) for {}", .{
+ log.debug("setting shdr({x},{s}) for {f}", .{
shndx,
elf_file.getShString(elf_file.sections.items(.shdr)[shndx].sh_name),
ip.getNav(func.owner_nav).fqn.fmt(ip),
@@ -1529,7 +1529,7 @@ pub fn updateNav(
const ip = &zcu.intern_pool;
const nav = ip.getNav(nav_index);
- log.debug("updateNav {}({d})", .{ nav.fqn.fmt(ip), nav_index });
+ log.debug("updateNav {f}({d})", .{ nav.fqn.fmt(ip), nav_index });
const nav_init = switch (ip.indexToKey(nav.status.fully_resolved.val)) {
.func => .none,
@@ -1576,7 +1576,7 @@ pub fn updateNav(
const code = code_buffer.items;
const shndx = try self.getNavShdrIndex(elf_file, zcu, nav_index, sym_index, code);
- log.debug("setting shdr({x},{s}) for {}", .{
+ log.debug("setting shdr({x},{s}) for {f}", .{
shndx,
elf_file.getShString(elf_file.sections.items(.shdr)[shndx].sh_name),
nav.fqn.fmt(ip),
@@ -1622,7 +1622,7 @@ fn updateLazySymbol(
defer code_buffer.deinit(gpa);
const name_str_index = blk: {
- const name = try std.fmt.allocPrint(gpa, "__lazy_{s}_{}", .{
+ const name = try std.fmt.allocPrint(gpa, "__lazy_{s}_{f}", .{
@tagName(sym.kind),
Type.fromInterned(sym.ty).fmt(pt),
});
@@ -1941,7 +1941,7 @@ pub fn allocateAtom(self: *ZigObject, atom_ptr: *Atom, requires_padding: bool, e
.requires_padding = requires_padding,
});
atom_ptr.value = @intCast(alloc_res.value);
- log.debug("allocated {s} at {x}\n placement {?}", .{
+ log.debug("allocated {s} at {x}\n placement {f}", .{
atom_ptr.name(elf_file),
atom_ptr.offset(elf_file),
alloc_res.placement,
@@ -1986,7 +1986,7 @@ pub fn allocateAtom(self: *ZigObject, atom_ptr: *Atom, requires_padding: bool, e
atom_ptr.next_atom_ref = .{ .index = 0, .file = 0 };
}
- log.debug(" prev {?}, next {?}", .{ atom_ptr.prev_atom_ref, atom_ptr.next_atom_ref });
+ log.debug(" prev {f}, next {f}", .{ atom_ptr.prev_atom_ref, atom_ptr.next_atom_ref });
}
pub fn resetShdrIndexes(self: *ZigObject, backlinks: []const u32) void {
@@ -2271,7 +2271,7 @@ fn checkNavAllocated(pt: Zcu.PerThread, index: InternPool.Nav.Index, meta: AvMet
const zcu = pt.zcu;
const ip = &zcu.intern_pool;
const nav = ip.getNav(index);
- log.err("NAV {}({d}) assigned symbol {d} but not allocated!", .{
+ log.err("NAV {f}({d}) assigned symbol {d} but not allocated!", .{
nav.fqn.fmt(ip),
index,
meta.symbol_index,
@@ -2284,7 +2284,7 @@ fn checkUavAllocated(pt: Zcu.PerThread, index: InternPool.Index, meta: AvMetadat
const zcu = pt.zcu;
const uav = Value.fromInterned(index);
const ty = uav.typeOf(zcu);
- log.err("UAV {}({d}) assigned symbol {d} but not allocated!", .{
+ log.err("UAV {f}({d}) assigned symbol {d} but not allocated!", .{
ty.fmt(pt),
index,
meta.symbol_index,
src/link/MachO/dyld_info/bind.zig
@@ -205,7 +205,7 @@ pub const Bind = struct {
}
}
- log.debug("{x}, {d}, {x}, {?x}, {s}", .{ offset, count, skip, addend, @tagName(state) });
+ log.debug("{x}, {d}, {x}, {x}, {s}", .{ offset, count, skip, addend, @tagName(state) });
log.debug(" => {x}", .{current.offset});
switch (state) {
.start => {
@@ -447,7 +447,7 @@ pub const WeakBind = struct {
}
}
- log.debug("{x}, {d}, {x}, {?x}, {s}", .{ offset, count, skip, addend, @tagName(state) });
+ log.debug("{x}, {d}, {x}, {x}, {s}", .{ offset, count, skip, addend, @tagName(state) });
log.debug(" => {x}", .{current.offset});
switch (state) {
.start => {
src/link/MachO/Atom.zig
@@ -653,7 +653,7 @@ fn resolveRelocInner(
const divExact = struct {
fn divExact(atom: Atom, r: Relocation, num: u12, den: u12, ctx: *MachO) !u12 {
return math.divExact(u12, num, den) catch {
- try ctx.reportParseError2(atom.getFile(ctx).getIndex(), "{s}: unexpected remainder when resolving {s} at offset 0x{x}", .{
+ try ctx.reportParseError2(atom.getFile(ctx).getIndex(), "{s}: unexpected remainder when resolving {f} at offset 0x{x}", .{
atom.getName(ctx),
r.fmtPretty(ctx.getTarget().cpu.arch),
r.offset,
src/link/Wasm/Flush.zig
@@ -534,7 +534,7 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void {
wasm.memories.limits.max = @intCast(max_memory / page_size);
wasm.memories.limits.flags.has_max = true;
if (shared_memory) wasm.memories.limits.flags.is_shared = true;
- log.debug("maximum memory pages: {?d}", .{wasm.memories.limits.max});
+ log.debug("maximum memory pages: {d}", .{wasm.memories.limits.max});
}
f.memory_layout_finished = true;
src/link/C.zig
@@ -493,7 +493,7 @@ pub fn flush(self: *C, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: std.P
const file = self.base.file.?;
file.setEndPos(f.file_size) catch |err| return diags.fail("failed to allocate file: {s}", .{@errorName(err)});
- file.pwritevAll(f.all_buffers.items, 0) catch |err| return diags.fail("failed to write to '{'}': {s}", .{
+ file.pwritevAll(f.all_buffers.items, 0) catch |err| return diags.fail("failed to write to '{f'}': {s}", .{
self.base.emit, @errorName(err),
});
}
src/link/Coff.zig
@@ -2588,7 +2588,7 @@ fn logSymtab(coff: *Coff) void {
.DEBUG => unreachable, // TODO
else => @intFromEnum(sym.section_number),
};
- log.debug(" %{d}: {?s} @{x} in {s}({d}), {s}", .{
+ log.debug(" %{d}: {s} @{x} in {s}({d}), {s}", .{
sym_id,
coff.getSymbolName(.{ .sym_index = @as(u32, @intCast(sym_id)), .file = null }),
sym.value,
src/link/Elf.zig
@@ -3544,7 +3544,7 @@ pub fn addRelaDyn(self: *Elf, opts: RelaDyn) !void {
}
pub fn addRelaDynAssumeCapacity(self: *Elf, opts: RelaDyn) void {
- relocs_log.debug(" {s}: [{x} => {d}({s})] + {x}", .{
+ relocs_log.debug(" {f}: [{x} => {d}({s})] + {x}", .{
relocation.fmtRelocType(opts.type, self.getTarget().cpu.arch),
opts.offset,
opts.sym,
@@ -3791,7 +3791,7 @@ fn reportUndefinedSymbols(self: *Elf, undefs: anytype) !void {
for (refs.items[0..nrefs]) |ref| {
const atom_ptr = self.atom(ref).?;
const file_ptr = atom_ptr.file(self).?;
- err.addNote("referenced by {s}:{s}", .{ file_ptr.fmtPath(), atom_ptr.name(self) });
+ err.addNote("referenced by {f}:{s}", .{ file_ptr.fmtPath(), atom_ptr.name(self) });
}
if (refs.items.len > max_notes) {
@@ -4020,19 +4020,19 @@ fn fmtDumpState(self: *Elf, writer: *std.io.Writer) std.io.Writer.Error!void {
{
try writer.writeAll("atom lists\n");
for (slice.items(.shdr), slice.items(.atom_list_2), 0..) |shdr, atom_list, shndx| {
- try writer.print("shdr({d}) : {s} : {}\n", .{ shndx, self.getShString(shdr.sh_name), atom_list.fmt(self) });
+ try writer.print("shdr({d}) : {s} : {f}\n", .{ shndx, self.getShString(shdr.sh_name), atom_list.fmt(self) });
}
}
if (self.requiresThunks()) {
try writer.writeAll("thunks\n");
for (self.thunks.items, 0..) |th, index| {
- try writer.print("thunk({d}) : {}\n", .{ index, th.fmt(self) });
+ try writer.print("thunk({d}) : {f}\n", .{ index, th.fmt(self) });
}
}
- try writer.print("{}\n", .{self.got.fmt(self)});
- try writer.print("{}\n", .{self.plt.fmt(self)});
+ try writer.print("{f}\n", .{self.got.fmt(self)});
+ try writer.print("{f}\n", .{self.plt.fmt(self)});
try writer.writeAll("Output groups\n");
for (self.group_sections.items) |cg| {
@@ -4041,7 +4041,7 @@ fn fmtDumpState(self: *Elf, writer: *std.io.Writer) std.io.Writer.Error!void {
try writer.writeAll("\nOutput merge sections\n");
for (self.merge_sections.items) |msec| {
- try writer.print(" shdr({d}) : {}\n", .{ msec.output_section_index, msec.fmt(self) });
+ try writer.print(" shdr({d}) : {f}\n", .{ msec.output_section_index, msec.fmt(self) });
}
try writer.writeAll("\nOutput shdrs\n");
@@ -4424,7 +4424,7 @@ fn createThunks(elf_file: *Elf, atom_list: *AtomList) !void {
thunk_ptr.value = try advance(atom_list, thunk_ptr.size(elf_file), Atom.Alignment.fromNonzeroByteUnits(2));
- log.debug("thunk({d}) : {}", .{ thunk_index, thunk_ptr.fmt(elf_file) });
+ log.debug("thunk({d}) : {f}", .{ thunk_index, thunk_ptr.fmt(elf_file) });
}
}
src/Package/Fetch/git.zig
@@ -119,14 +119,8 @@ pub const Oid = union(Format) {
} else error.InvalidOid;
}
- pub fn format(
- oid: Oid,
- comptime fmt: []const u8,
- options: std.fmt.FormatOptions,
- writer: anytype,
- ) @TypeOf(writer).Error!void {
- _ = fmt;
- _ = options;
+ pub fn format(oid: Oid, writer: *std.io.Writer, comptime fmt: []const u8) std.io.Writer.Error!void {
+ comptime assert(fmt.len == 0);
try writer.print("{x}", .{oid.slice()});
}
@@ -669,13 +663,13 @@ pub const Session = struct {
fn init(allocator: Allocator, uri: std.Uri) !Location {
const scheme = try allocator.dupe(u8, uri.scheme);
errdefer allocator.free(scheme);
- const user = if (uri.user) |user| try std.fmt.allocPrint(allocator, "{user}", .{user}) else null;
+ const user = if (uri.user) |user| try std.fmt.allocPrint(allocator, "{fuser}", .{user}) else null;
errdefer if (user) |s| allocator.free(s);
- const password = if (uri.password) |password| try std.fmt.allocPrint(allocator, "{password}", .{password}) else null;
+ const password = if (uri.password) |password| try std.fmt.allocPrint(allocator, "{fpassword}", .{password}) else null;
errdefer if (password) |s| allocator.free(s);
- const host = if (uri.host) |host| try std.fmt.allocPrint(allocator, "{host}", .{host}) else null;
+ const host = if (uri.host) |host| try std.fmt.allocPrint(allocator, "{fhost}", .{host}) else null;
errdefer if (host) |s| allocator.free(s);
- const path = try std.fmt.allocPrint(allocator, "{path}", .{uri.path});
+ const path = try std.fmt.allocPrint(allocator, "{fpath}", .{uri.path});
errdefer allocator.free(path);
// The query and fragment are not used as part of the base server URI.
return .{
@@ -706,7 +700,7 @@ pub const Session = struct {
fn getCapabilities(session: *Session, http_headers_buffer: []u8) !CapabilityIterator {
var info_refs_uri = session.location.uri;
{
- const session_uri_path = try std.fmt.allocPrint(session.allocator, "{path}", .{session.location.uri.path});
+ const session_uri_path = try std.fmt.allocPrint(session.allocator, "{fpath}", .{session.location.uri.path});
defer session.allocator.free(session_uri_path);
info_refs_uri.path = .{ .percent_encoded = try std.fs.path.resolvePosix(session.allocator, &.{ "/", session_uri_path, "info/refs" }) };
}
@@ -730,7 +724,7 @@ pub const Session = struct {
if (request.response.status != .ok) return error.ProtocolError;
const any_redirects_occurred = request.redirect_behavior.remaining() < max_redirects;
if (any_redirects_occurred) {
- const request_uri_path = try std.fmt.allocPrint(session.allocator, "{path}", .{request.uri.path});
+ const request_uri_path = try std.fmt.allocPrint(session.allocator, "{fpath}", .{request.uri.path});
defer session.allocator.free(request_uri_path);
if (!mem.endsWith(u8, request_uri_path, "/info/refs")) return error.UnparseableRedirect;
var new_uri = request.uri;
@@ -817,7 +811,7 @@ pub const Session = struct {
pub fn listRefs(session: Session, options: ListRefsOptions) !RefIterator {
var upload_pack_uri = session.location.uri;
{
- const session_uri_path = try std.fmt.allocPrint(session.allocator, "{path}", .{session.location.uri.path});
+ const session_uri_path = try std.fmt.allocPrint(session.allocator, "{fpath}", .{session.location.uri.path});
defer session.allocator.free(session_uri_path);
upload_pack_uri.path = .{ .percent_encoded = try std.fs.path.resolvePosix(session.allocator, &.{ "/", session_uri_path, "git-upload-pack" }) };
}
@@ -932,7 +926,7 @@ pub const Session = struct {
) !FetchStream {
var upload_pack_uri = session.location.uri;
{
- const session_uri_path = try std.fmt.allocPrint(session.allocator, "{path}", .{session.location.uri.path});
+ const session_uri_path = try std.fmt.allocPrint(session.allocator, "{fpath}", .{session.location.uri.path});
defer session.allocator.free(session_uri_path);
upload_pack_uri.path = .{ .percent_encoded = try std.fs.path.resolvePosix(session.allocator, &.{ "/", session_uri_path, "git-upload-pack" }) };
}
src/Package/Fetch.zig
@@ -1079,13 +1079,13 @@ fn initResource(f: *Fetch, uri: std.Uri, server_header_buffer: []u8) RunError!Re
});
const notes_start = try eb.reserveNotes(notes_len);
eb.extra.items[notes_start] = @intFromEnum(try eb.addErrorMessage(.{
- .msg = try eb.printString("try .url = \"{;+/}#{}\",", .{ uri, want_oid }),
+ .msg = try eb.printString("try .url = \"{f;+/}#{f}\",", .{ uri, want_oid }),
}));
return error.FetchFailed;
}
var want_oid_buf: [git.Oid.max_formatted_length]u8 = undefined;
- _ = std.fmt.bufPrint(&want_oid_buf, "{}", .{want_oid}) catch unreachable;
+ _ = std.fmt.bufPrint(&want_oid_buf, "{f}", .{want_oid}) catch unreachable;
var fetch_stream = session.fetch(&.{&want_oid_buf}, server_header_buffer) catch |err| {
return f.fail(f.location_tok, try eb.printString(
"unable to create fetch stream: {s}",
src/Builtin.zig
@@ -317,7 +317,7 @@ pub fn updateFileOnDisk(file: *File, comp: *Compilation) !void {
if (root_dir.statFile(sub_path)) |stat| {
if (stat.size != file.source.?.len) {
std.log.warn(
- "the cached file '{f}{s}' had the wrong size. Expected {d}, found {d}. " ++
+ "the cached file '{f}' had the wrong size. Expected {d}, found {d}. " ++
"Overwriting with correct file contents now",
.{ file.path.fmt(comp), file.source.?.len, stat.size },
);
src/Compilation.zig
@@ -399,9 +399,8 @@ pub const Path = struct {
const Formatter = struct {
p: Path,
comp: *Compilation,
- pub fn format(f: Formatter, comptime unused_fmt: []const u8, options: std.fmt.FormatOptions, w: anytype) !void {
+ pub fn format(f: Formatter, w: *std.io.Writer, comptime unused_fmt: []const u8) std.io.Writer.Error!void {
comptime assert(unused_fmt.len == 0);
- _ = options;
const root_path: []const u8 = switch (f.p.root) {
.zig_lib => f.comp.dirs.zig_lib.path orelse ".",
.global_cache => f.comp.dirs.global_cache.path orelse ".",
@@ -6034,7 +6033,9 @@ fn updateWin32Resource(comp: *Compilation, win32_resource: *Win32Resource, win32
// 24 is RT_MANIFEST
const resource_type = 24;
- const input = try std.fmt.allocPrint(arena, "{} {} \"{s}\"", .{ resource_id, resource_type, fmtRcEscape(src_path) });
+ const input = try std.fmt.allocPrint(arena, "{} {} \"{f}\"", .{
+ resource_id, resource_type, fmtRcEscape(src_path),
+ });
try o_dir.writeFile(.{ .sub_path = rc_basename, .data = input });
src/link.zig
@@ -838,7 +838,7 @@ pub const File = struct {
const cached_pp_file_path = the_key.status.success.object_path;
cached_pp_file_path.root_dir.handle.copyFile(cached_pp_file_path.sub_path, emit.root_dir.handle, emit.sub_path, .{}) catch |err| {
const diags = &base.comp.link_diags;
- return diags.fail("failed to copy '{'}' to '{'}': {s}", .{
+ return diags.fail("failed to copy '{f'}' to '{f'}': {s}", .{
@as(Path, cached_pp_file_path), @as(Path, emit), @errorName(err),
});
};
@@ -2086,13 +2086,13 @@ fn resolvePathInputLib(
}) {
var file = test_path.root_dir.handle.openFile(test_path.sub_path, .{}) catch |err| switch (err) {
error.FileNotFound => return .no_match,
- else => |e| fatal("unable to search for {s} library '{'}': {s}", .{
+ else => |e| fatal("unable to search for {s} library '{f'}': {s}", .{
@tagName(link_mode), test_path, @errorName(e),
}),
};
errdefer file.close();
try ld_script_bytes.resize(gpa, @max(std.elf.MAGIC.len, std.elf.ARMAG.len));
- const n = file.preadAll(ld_script_bytes.items, 0) catch |err| fatal("failed to read '{'}': {s}", .{
+ const n = file.preadAll(ld_script_bytes.items, 0) catch |err| fatal("failed to read '{f'}': {s}", .{
test_path, @errorName(err),
});
const buf = ld_script_bytes.items[0..n];
@@ -2101,14 +2101,14 @@ fn resolvePathInputLib(
return finishResolveLibInput(resolved_inputs, test_path, file, link_mode, pq.query);
}
const stat = file.stat() catch |err|
- fatal("failed to stat {}: {s}", .{ test_path, @errorName(err) });
+ fatal("failed to stat {f}: {s}", .{ test_path, @errorName(err) });
const size = std.math.cast(u32, stat.size) orelse
- fatal("{}: linker script too big", .{test_path});
+ fatal("{f}: linker script too big", .{test_path});
try ld_script_bytes.resize(gpa, size);
const buf2 = ld_script_bytes.items[n..];
const n2 = file.preadAll(buf2, n) catch |err|
- fatal("failed to read {}: {s}", .{ test_path, @errorName(err) });
- if (n2 != buf2.len) fatal("failed to read {}: unexpected end of file", .{test_path});
+ fatal("failed to read {f}: {s}", .{ test_path, @errorName(err) });
+ if (n2 != buf2.len) fatal("failed to read {f}: unexpected end of file", .{test_path});
var diags = Diags.init(gpa);
defer diags.deinit();
const ld_script_result = LdScript.parse(gpa, &diags, test_path, ld_script_bytes.items);
@@ -2128,7 +2128,7 @@ fn resolvePathInputLib(
}
var ld_script = ld_script_result catch |err|
- fatal("{}: failed to parse linker script: {s}", .{ test_path, @errorName(err) });
+ fatal("{f}: failed to parse linker script: {s}", .{ test_path, @errorName(err) });
defer ld_script.deinit(gpa);
try unresolved_inputs.ensureUnusedCapacity(gpa, ld_script.args.len);
@@ -2159,7 +2159,7 @@ fn resolvePathInputLib(
var file = test_path.root_dir.handle.openFile(test_path.sub_path, .{}) catch |err| switch (err) {
error.FileNotFound => return .no_match,
- else => |e| fatal("unable to search for {s} library {}: {s}", .{
+ else => |e| fatal("unable to search for {s} library {f}: {s}", .{
@tagName(link_mode), test_path, @errorName(e),
}),
};
src/print_value.zig
@@ -73,35 +73,35 @@ pub fn print(
else => try writer.writeAll(@tagName(simple_value)),
},
.variable => try writer.writeAll("(variable)"),
- .@"extern" => |e| try writer.print("(extern '{}')", .{e.name.fmt(ip)}),
- .func => |func| try writer.print("(function '{}')", .{ip.getNav(func.owner_nav).name.fmt(ip)}),
+ .@"extern" => |e| try writer.print("(extern '{f}')", .{e.name.fmt(ip)}),
+ .func => |func| try writer.print("(function '{f}')", .{ip.getNav(func.owner_nav).name.fmt(ip)}),
.int => |int| switch (int.storage) {
inline .u64, .i64, .big_int => |x| try writer.print("{}", .{x}),
.lazy_align => |ty| if (opt_sema != null) {
const a = try Type.fromInterned(ty).abiAlignmentSema(pt);
try writer.print("{}", .{a.toByteUnits() orelse 0});
- } else try writer.print("@alignOf({})", .{Type.fromInterned(ty).fmt(pt)}),
+ } else try writer.print("@alignOf({f})", .{Type.fromInterned(ty).fmt(pt)}),
.lazy_size => |ty| if (opt_sema != null) {
const s = try Type.fromInterned(ty).abiSizeSema(pt);
try writer.print("{}", .{s});
- } else try writer.print("@sizeOf({})", .{Type.fromInterned(ty).fmt(pt)}),
+ } else try writer.print("@sizeOf({f})", .{Type.fromInterned(ty).fmt(pt)}),
},
- .err => |err| try writer.print("error.{}", .{
+ .err => |err| try writer.print("error.{f}", .{
err.name.fmt(ip),
}),
.error_union => |error_union| switch (error_union.val) {
- .err_name => |err_name| try writer.print("error.{}", .{
+ .err_name => |err_name| try writer.print("error.{f}", .{
err_name.fmt(ip),
}),
.payload => |payload| try print(Value.fromInterned(payload), writer, level, pt, opt_sema),
},
- .enum_literal => |enum_literal| try writer.print(".{}", .{
+ .enum_literal => |enum_literal| try writer.print(".{f}", .{
enum_literal.fmt(ip),
}),
.enum_tag => |enum_tag| {
const enum_type = ip.loadEnumType(val.typeOf(zcu).toIntern());
if (enum_type.tagValueIndex(ip, val.toIntern())) |tag_index| {
- return writer.print(".{i}", .{enum_type.names.get(ip)[tag_index].fmt(ip)});
+ return writer.print(".{fi}", .{enum_type.names.get(ip)[tag_index].fmt(ip)});
}
if (level == 0) {
return writer.writeAll("@enumFromInt(...)");
@@ -164,7 +164,7 @@ pub fn print(
}
if (un.tag == .none) {
const backing_ty = try val.typeOf(zcu).unionBackingType(pt);
- try writer.print("@bitCast(@as({}, ", .{backing_ty.fmt(pt)});
+ try writer.print("@bitCast(@as({f}, ", .{backing_ty.fmt(pt)});
try print(Value.fromInterned(un.val), writer, level - 1, pt, opt_sema);
try writer.writeAll("))");
} else {
@@ -206,7 +206,7 @@ fn printAggregate(
for (0..max_len) |i| {
if (i != 0) try writer.writeAll(", ");
const field_name = ty.structFieldName(@intCast(i), zcu).unwrap().?;
- try writer.print(".{i} = ", .{field_name.fmt(ip)});
+ try writer.print(".{fi} = ", .{field_name.fmt(ip)});
try print(try val.fieldValue(pt, i), writer, level - 1, pt, opt_sema);
}
try writer.writeAll(" }");
@@ -391,14 +391,14 @@ pub fn printPtrDerivation(
const agg_ty = (try field.parent.ptrType(pt)).childType(zcu);
switch (agg_ty.zigTypeTag(zcu)) {
.@"struct" => if (agg_ty.structFieldName(field.field_idx, zcu).unwrap()) |field_name| {
- try writer.print(".{i}", .{field_name.fmt(ip)});
+ try writer.print(".{fi}", .{field_name.fmt(ip)});
} else {
try writer.print("[{d}]", .{field.field_idx});
},
.@"union" => {
const tag_ty = agg_ty.unionTagTypeHypothetical(zcu);
const field_name = tag_ty.enumFieldName(field.field_idx, zcu);
- try writer.print(".{i}", .{field_name.fmt(ip)});
+ try writer.print(".{fi}", .{field_name.fmt(ip)});
},
.pointer => switch (field.field_idx) {
Value.slice_ptr_index => try writer.writeAll(".ptr"),
@@ -416,12 +416,12 @@ pub fn printPtrDerivation(
},
.offset_and_cast => |oac| if (oac.byte_offset == 0) root: {
- try writer.print("@as({}, @ptrCast(", .{oac.new_ptr_ty.fmt(pt)});
+ try writer.print("@as({f}, @ptrCast(", .{oac.new_ptr_ty.fmt(pt)});
const root = try printPtrDerivation(oac.parent.*, writer, pt, .rvalue, root_strat, ptr_depth - 1);
try writer.writeAll("))");
break :root root;
} else root: {
- try writer.print("@as({}, @ptrFromInt(@intFromPtr(", .{oac.new_ptr_ty.fmt(pt)});
+ try writer.print("@as({f}, @ptrFromInt(@intFromPtr(", .{oac.new_ptr_ty.fmt(pt)});
const root = try printPtrDerivation(oac.parent.*, writer, pt, .rvalue, root_strat, ptr_depth - 1);
try writer.print(") + {d}))", .{oac.byte_offset});
break :root root;
@@ -433,22 +433,22 @@ pub fn printPtrDerivation(
if (root_or_null == null) switch (root_strat) {
.str => |x| try writer.writeAll(x),
.print_val => |x| switch (derivation) {
- .int => |int| try writer.print("@as({}, @ptrFromInt(0x{x}))", .{ int.ptr_ty.fmt(pt), int.addr }),
- .nav_ptr => |nav| try writer.print("{}", .{ip.getNav(nav).fqn.fmt(ip)}),
+ .int => |int| try writer.print("@as({f}, @ptrFromInt(0x{x}))", .{ int.ptr_ty.fmt(pt), int.addr }),
+ .nav_ptr => |nav| try writer.print("{f}", .{ip.getNav(nav).fqn.fmt(ip)}),
.uav_ptr => |uav| {
const ty = Value.fromInterned(uav.val).typeOf(zcu);
- try writer.print("@as({}, ", .{ty.fmt(pt)});
+ try writer.print("@as({f}, ", .{ty.fmt(pt)});
try print(Value.fromInterned(uav.val), writer, x.level - 1, pt, x.opt_sema);
try writer.writeByte(')');
},
.comptime_alloc_ptr => |info| {
- try writer.print("@as({}, ", .{info.val.typeOf(zcu).fmt(pt)});
+ try writer.print("@as({f}, ", .{info.val.typeOf(zcu).fmt(pt)});
try print(info.val, writer, x.level - 1, pt, x.opt_sema);
try writer.writeByte(')');
},
.comptime_field_ptr => |val| {
const ty = val.typeOf(zcu);
- try writer.print("@as({}, ", .{ty.fmt(pt)});
+ try writer.print("@as({f}, ", .{ty.fmt(pt)});
try print(val, writer, x.level - 1, pt, x.opt_sema);
try writer.writeByte(')');
},