mirror of
https://github.com/ziglang/zig.git
synced 2026-02-18 23:39:17 +00:00
std.fmt.format: add helpful compile error for non-tuple args
This commit is contained in:
parent
d972d1c942
commit
25051832b3
@ -94,6 +94,9 @@ pub fn format(
|
||||
args: var,
|
||||
) Errors!void {
|
||||
const ArgSetType = @IntType(false, 32);
|
||||
if (@typeInfo(@TypeOf(args)) != .Struct) {
|
||||
@compileError("Expected tuple or struct argument, found " ++ @typeName(@TypeOf(args)));
|
||||
}
|
||||
if (args.len > ArgSetType.bit_count) {
|
||||
@compileError("32 arguments max are supported per format call");
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user