By working on upgrade to zig 0.15.2 standard of gcc-arm-to-zig project, I encountered a weird error while running tests.
└─ run test
└─ compile test Debug native 1 errors
path/zig-x86_64-linux-0.15.2/lib/std/Io/Writer.zig:1200:9: error: ambiguous format string; specify {f} to call format method, or {any} to skip it
@compileError(“ambiguous format string; specify {f} to call format method, or {any} to skip it”);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
referenced by:
print__anon_17990: path/zig-x86_64-linux-0.15.2/lib/std/Io/Writer.zig:700:25
print__anon_17985: path/zig-x86_64-linux-0.15.2/lib/std/debug.zig:231:23
I rapidly isolated the responsible test of this error:
test "Valid Conversion" {
const some_query = std.Target.Query{
.cpu_arch = .thumb,
.os_tag = .freestanding,
.abi = .eabihf,
.cpu_model = std.Target.Query.CpuModel{ .explicit = &std.Target.arm.cpu.cortex_m7 },
.cpu_features_add = std.Target.arm.featureSet(&[_]std.Target.arm.Feature{std.Target.arm.Feature.fp_armv8d16sp}),
};
const my_target: Target = .{ .cpu = gcc.cpu.@"cortex-m7", .instruction_set = .thumb, .float_abi = .hard, .fpu = gcc.fpu.@"fpv5-sp-d16" };
try std.testing.expectEqual(some_query, try my_target.toTargetQuery());
}
After digging deep into, I finally isolated the std.Target member behind this weird error. It can be reproduce with this test:
test "expectEqualDeep error"{
try std.testing.expectEqualDeep(null, std.Target.Os.WindowsVersion.win10);
}
The windows version value doesn’t matter, nor the other member of expectation test.I tryed to understand why this fail but without success. Before opening a ticket, I checked if zig main branch encounter the same behavior but no. So, for now, I simply replaced expectEqualDeep by expectEqual.But If someone can explain me where this behavior come from, I’m in.
PS: I’m not English speaker, sorry for the poor quality of my text.