zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 42b2fb4c5d9be18aa38b1c4ecea2fe59f1c2dba1 (tree)
parent aa1a06bf9b806761f176d9fa1a1e34b00bb7828c
Author: Andrew Kelley <andrew@ziglang.org>
Date:   Tue, 19 Jul 2022 19:55:12 -0700

Autodoc: stage2 miscompilation workaround

There is no issue open for this yet; I will file one after pushing this
commit.

Diffstat:
Msrc/Autodoc.zig | 18++----------------
1 file changed, 2 insertions(+), 16 deletions(-)

diff --git a/src/Autodoc.zig b/src/Autodoc.zig @@ -361,21 +361,7 @@ const DocData = struct { /// `ComptimeExpr` represents the result of a piece of comptime logic /// that we weren't able to analyze fully. Examples of that are comptime /// function calls and comptime if / switch / ... expressions. - const DocTypeKinds = blk: { - var info = @typeInfo(std.builtin.TypeId); - const original_len = info.Enum.fields.len; - info.Enum.fields = info.Enum.fields ++ [2]std.builtin.TypeInfo.EnumField{ - .{ - .name = "ComptimeExpr", - .value = original_len, - }, - .{ - .name = "Unanalyzed", - .value = original_len + 1, - }, - }; - break :blk @Type(info); - }; + const DocTypeKinds = @typeInfo(Type).Union.tag_type.?; const ComptimeExpr = struct { code: []const u8, @@ -433,7 +419,7 @@ const DocData = struct { @"comptime": bool = false, }; - const Type = union(DocTypeKinds) { + const Type = union(enum) { Unanalyzed: struct {}, Type: struct { name: []const u8 }, Void: struct { name: []const u8 },