Add error when too few arguments are provided to std.fmt

This commit is contained in:
shiimizu 2019-10-31 10:23:02 -07:00 committed by Andrew Kelley
parent f81f36e2ff
commit 7277670843

View File

@ -167,6 +167,10 @@ pub fn format(
'}' => {
const arg_to_print = comptime nextArg(&used_pos_args, maybe_pos_arg, &next_arg);
if (arg_to_print >= args.len) {
@compileError("Too few arguments");
}
try formatType(
args[arg_to_print],
fmt[0..0],