From 42b2fb4c5d9be18aa38b1c4ecea2fe59f1c2dba1 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Tue, 19 Jul 2022 19:55:12 -0700 Subject: [PATCH] Autodoc: stage2 miscompilation workaround There is no issue open for this yet; I will file one after pushing this commit. --- src/Autodoc.zig | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/src/Autodoc.zig b/src/Autodoc.zig index 9e68bb23e2..9549cedb8d 100644 --- 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 },