authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-07-19 19:55:12-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-07-19 19:55:12-07:00
log42b2fb4c5d9be18aa38b1c4ecea2fe59f1c2dba1
treef5b492aac987a2bd94c01712a4e2a5975567a77b
parentaa1a06bf9b806761f176d9fa1a1e34b00bb7828c

Autodoc: stage2 miscompilation workaround

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

1 files changed, 2 insertions(+), 16 deletions(-)

src/Autodoc.zig+2-16
...@@ -361,21 +361,7 @@ const DocData = struct {...@@ -361,21 +361,7 @@ const DocData = struct {
361 /// `ComptimeExpr` represents the result of a piece of comptime logic361 /// `ComptimeExpr` represents the result of a piece of comptime logic
362 /// that we weren't able to analyze fully. Examples of that are comptime362 /// that we weren't able to analyze fully. Examples of that are comptime
363 /// function calls and comptime if / switch / ... expressions.363 /// function calls and comptime if / switch / ... expressions.
364 const DocTypeKinds = blk: {364 const DocTypeKinds = @typeInfo(Type).Union.tag_type.?;
365 var info = @typeInfo(std.builtin.TypeId);
366 const original_len = info.Enum.fields.len;
367 info.Enum.fields = info.Enum.fields ++ [2]std.builtin.TypeInfo.EnumField{
368 .{
369 .name = "ComptimeExpr",
370 .value = original_len,
371 },
372 .{
373 .name = "Unanalyzed",
374 .value = original_len + 1,
375 },
376 };
377 break :blk @Type(info);
378 };
379365
380 const ComptimeExpr = struct {366 const ComptimeExpr = struct {
381 code: []const u8,367 code: []const u8,
...@@ -433,7 +419,7 @@ const DocData = struct {...@@ -433,7 +419,7 @@ const DocData = struct {
433 @"comptime": bool = false,419 @"comptime": bool = false,
434 };420 };
435421
436 const Type = union(DocTypeKinds) {422 const Type = union(enum) {
437 Unanalyzed: struct {},423 Unanalyzed: struct {},
438 Type: struct { name: []const u8 },424 Type: struct { name: []const u8 },
439 Void: struct { name: []const u8 },425 Void: struct { name: []const u8 },