Skip to content

Conversation

daurnimator
Copy link
Contributor

Possible since #4559

@daurnimator daurnimator added the standard library This issue involves writing Zig code for the standard library. label Mar 8, 2020
Copy link
Member

@andrewrk andrewrk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test case plz

@daurnimator daurnimator force-pushed the pretty-print-non-exhaustive-enums branch from 6f543e9 to 60a0947 Compare March 10, 2020 12:37
@daurnimator daurnimator force-pushed the pretty-print-non-exhaustive-enums branch from 60a0947 to c1e60ec Compare April 2, 2020 09:45
@daurnimator
Copy link
Contributor Author

Test is failing with:

/Users/runner/runners/2.165.2/work/1/s/lib/std/fmt.zig:381:37: error: evaluation exceeded 1000 backwards branches
                comptime std.mem.eql(u8, fmt, "b"))
                                    ^
/Users/runner/runners/2.165.2/work/1/s/lib/std/fmt.zig:182:35: note: called from here
                    try formatType(
                                  ^
/Users/runner/runners/2.165.2/work/1/s/lib/std/io/out_stream.zig:28:34: note: called from here
            return std.fmt.format(self, format, args);
                                 ^
/Users/runner/runners/2.165.2/work/1/s/lib/std/debug.zig:270:37: note: called from here
                noasync stderr.print(format ++ "\n", args) catch os.abort();
                                    ^
/Users/runner/runners/2.165.2/work/1/s/lib/std/debug.zig:235:15: note: called from here
    panicExtra(null, first_trace_addr, format, args);
              ^
/Users/runner/runners/2.165.2/work/1/s/lib/std/os/windows.zig:407:36: note: called from here
                    std.debug.panic("unexpected error: {}\n", .{err});
                                   ^
/Users/runner/runners/2.165.2/work/1/s/lib/std/os/windows.zig:393:35: note: called from here
) GetQueuedCompletionStatusResult {
                                  ^

I suspect because of iterating over a large enum with

                inline for (enumInfo.fields) |enumField| {
                    if (@enumToInt(value) == enumField.value) {
                        has_name = true;
                        break;
                    }
                }

Should I put in a @setEvalBranchQuota? or what is the recommended solution?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
standard library This issue involves writing Zig code for the standard library.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants