aboutsummaryrefslogtreecommitdiff
path: root/lib/std/fmtstream.zig
diff options
context:
space:
mode:
authorBenjamin Feng <benjamin.feng@glassdoor.com>2020-02-29 15:02:29 -0600
committerBenjamin Feng <benjamin.feng@glassdoor.com>2020-03-12 09:19:32 -0500
commitf51c8f26c195819bb49a641c82ee65bb2f8e3044 (patch)
tree789f328900736d4bd01aa69f6cbc92ba406c60bb /lib/std/fmtstream.zig
parent78d12762a9c78f9563a3cfd29541d0a04f78ab58 (diff)
downloadzig-f51c8f26c195819bb49a641c82ee65bb2f8e3044.tar.gz
zig-f51c8f26c195819bb49a641c82ee65bb2f8e3044.zip
Apply explicit error type
Diffstat (limited to 'lib/std/fmtstream.zig')
-rw-r--r--lib/std/fmtstream.zig24
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/std/fmtstream.zig b/lib/std/fmtstream.zig
index 3a2767c85a..ff7c492a19 100644
--- a/lib/std/fmtstream.zig
+++ b/lib/std/fmtstream.zig
@@ -316,7 +316,7 @@ pub fn formatType(
options: FormatOptions,
out_stream: var,
max_depth: usize,
-) !void {
+) @TypeOf(out_stream).Error!void {
if (comptime std.mem.eql(u8, fmt, "*")) {
try out_stream.writeAll(@typeName(@TypeOf(value).Child));
try out_stream.writeAll("@");
@@ -1472,19 +1472,19 @@ test "enum" {
try testFmt("E.Two", "{}", .{inst});
}
-// test "struct.self-referential" {
-// const S = struct {
-// const SelfType = @This();
-// a: ?*SelfType,
-// };
+test "struct.self-referential" {
+ const S = struct {
+ const SelfType = @This();
+ a: ?*SelfType,
+ };
-// var inst = S{
-// .a = null,
-// };
-// inst.a = &inst;
+ var inst = S{
+ .a = null,
+ };
+ inst.a = &inst;
-// try testFmt("S{ .a = S{ .a = S{ .a = S{ ... } } } }", "{}", .{inst});
-// }
+ try testFmt("S{ .a = S{ .a = S{ .a = S{ ... } } } }", "{}", .{inst});
+}
test "struct.zero-size" {
const A = struct {