| ... | @@ -495,6 +495,7 @@ fn formatType(value: anytype, comptime fmt: []const u8, options: FormatOptions, | ... | @@ -495,6 +495,7 @@ fn formatType(value: anytype, comptime fmt: []const u8, options: FormatOptions, |
| 495 | } else { | 495 | } else { |
| 496 | try format(writer, "@{x}", .{@intFromPtr(&value)}); | 496 | try format(writer, "@{x}", .{@intFromPtr(&value)}); |
| 497 | } | 497 | } |
| | 498 | return; |
| 498 | }, | 499 | }, |
| 499 | .@"struct" => |info| { | 500 | .@"struct" => |info| { |
| 500 | if (actual_fmt.len != 0) invalidFmtError(fmt, value); | 501 | if (actual_fmt.len != 0) invalidFmtError(fmt, value); |
| ... | @@ -530,6 +531,7 @@ fn formatType(value: anytype, comptime fmt: []const u8, options: FormatOptions, | ... | @@ -530,6 +531,7 @@ fn formatType(value: anytype, comptime fmt: []const u8, options: FormatOptions, |
| 530 | try formatType(@field(value, f.name), "any", options, writer, max_depth - 1); | 531 | try formatType(@field(value, f.name), "any", options, writer, max_depth - 1); |
| 531 | } | 532 | } |
| 532 | try writer.writeAll(" }"); | 533 | try writer.writeAll(" }"); |
| | 534 | return; |
| 533 | }, | 535 | }, |
| 534 | .pointer => |ptr_info| switch (ptr_info.size) { | 536 | .pointer => |ptr_info| switch (ptr_info.size) { |
| 535 | .one => switch (@typeInfo(ptr_info.child)) { | 537 | .one => switch (@typeInfo(ptr_info.child)) { |
| ... | @@ -547,7 +549,6 @@ fn formatType(value: anytype, comptime fmt: []const u8, options: FormatOptions, | ... | @@ -547,7 +549,6 @@ fn formatType(value: anytype, comptime fmt: []const u8, options: FormatOptions, |
| 547 | if (actual_fmt[0] == 's' and ptr_info.child == u8) { | 549 | if (actual_fmt[0] == 's' and ptr_info.child == u8) { |
| 548 | return formatBuf(std.mem.span(value), options, writer); | 550 | return formatBuf(std.mem.span(value), options, writer); |
| 549 | } | 551 | } |
| 550 | invalidFmtError(fmt, value); | | |
| 551 | }, | 552 | }, |
| 552 | .slice => { | 553 | .slice => { |
| 553 | if (actual_fmt.len == 0) { | 554 | if (actual_fmt.len == 0) { |
| ... | @@ -567,6 +568,7 @@ fn formatType(value: anytype, comptime fmt: []const u8, options: FormatOptions, | ... | @@ -567,6 +568,7 @@ fn formatType(value: anytype, comptime fmt: []const u8, options: FormatOptions, |
| 567 | } | 568 | } |
| 568 | } | 569 | } |
| 569 | try writer.writeAll(" }"); | 570 | try writer.writeAll(" }"); |
| | 571 | return; |
| 570 | }, | 572 | }, |
| 571 | }, | 573 | }, |
| 572 | .array => |info| { | 574 | .array => |info| { |
| ... | @@ -587,6 +589,7 @@ fn formatType(value: anytype, comptime fmt: []const u8, options: FormatOptions, | ... | @@ -587,6 +589,7 @@ fn formatType(value: anytype, comptime fmt: []const u8, options: FormatOptions, |
| 587 | } | 589 | } |
| 588 | } | 590 | } |
| 589 | try writer.writeAll(" }"); | 591 | try writer.writeAll(" }"); |
| | 592 | return; |
| 590 | }, | 593 | }, |
| 591 | .vector => |info| { | 594 | .vector => |info| { |
| 592 | if (max_depth == 0) { | 595 | if (max_depth == 0) { |
| ... | @@ -601,6 +604,7 @@ fn formatType(value: anytype, comptime fmt: []const u8, options: FormatOptions, | ... | @@ -601,6 +604,7 @@ fn formatType(value: anytype, comptime fmt: []const u8, options: FormatOptions, |
| 601 | } | 604 | } |
| 602 | } | 605 | } |
| 603 | try writer.writeAll(" }"); | 606 | try writer.writeAll(" }"); |
| | 607 | return; |
| 604 | }, | 608 | }, |
| 605 | .@"fn" => @compileError("unable to format function body type, use '*const " ++ @typeName(T) ++ "' for a function pointer type"), | 609 | .@"fn" => @compileError("unable to format function body type, use '*const " ++ @typeName(T) ++ "' for a function pointer type"), |
| 606 | .type => { | 610 | .type => { |