| author | |
| committer | |
| log | 39c2eee285f820282dedba4404cac1009a5ae2d6 |
| tree | 1f36e2df6d7fa82e24f1f44c8f465a09c6c7f9a7 |
| parent | 16dbb960fc8dada79cd42dd2ba1ebf0f66ccaaec |
5 files changed, 87 insertions(+), 87 deletions(-)
lib/build_runner.zig+30-30| ... | @@ -476,9 +476,9 @@ fn runStepNames( | ... | @@ -476,9 +476,9 @@ fn runStepNames( |
| 476 | 476 | ||
| 477 | if (run.enable_summary != false) { | 477 | if (run.enable_summary != false) { |
| 478 | const total_count = success_count + failure_count + pending_count + skipped_count; | 478 | const total_count = success_count + failure_count + pending_count + skipped_count; |
| 479 | ttyconf.setColor(stderr, .Cyan) catch {}; | 479 | ttyconf.setColor(stderr, .cyan) catch {}; |
| 480 | stderr.writeAll("Build Summary:") catch {}; | 480 | stderr.writeAll("Build Summary:") catch {}; |
| 481 | ttyconf.setColor(stderr, .Reset) catch {}; | 481 | ttyconf.setColor(stderr, .reset) catch {}; |
| 482 | stderr.writer().print(" {d}/{d} steps succeeded", .{ success_count, total_count }) catch {}; | 482 | stderr.writer().print(" {d}/{d} steps succeeded", .{ success_count, total_count }) catch {}; |
| 483 | if (skipped_count > 0) stderr.writer().print("; {d} skipped", .{skipped_count}) catch {}; | 483 | if (skipped_count > 0) stderr.writer().print("; {d} skipped", .{skipped_count}) catch {}; |
| 484 | if (failure_count > 0) stderr.writer().print("; {d} failed", .{failure_count}) catch {}; | 484 | if (failure_count > 0) stderr.writer().print("; {d} failed", .{failure_count}) catch {}; |
| ... | @@ -489,9 +489,9 @@ fn runStepNames( | ... | @@ -489,9 +489,9 @@ fn runStepNames( |
| 489 | if (test_leak_count > 0) stderr.writer().print("; {d} leaked", .{test_leak_count}) catch {}; | 489 | if (test_leak_count > 0) stderr.writer().print("; {d} leaked", .{test_leak_count}) catch {}; |
| 490 | 490 | ||
| 491 | if (run.enable_summary == null) { | 491 | if (run.enable_summary == null) { |
| 492 | ttyconf.setColor(stderr, .Dim) catch {}; | 492 | ttyconf.setColor(stderr, .dim) catch {}; |
| 493 | stderr.writeAll(" (disable with -fno-summary)") catch {}; | 493 | stderr.writeAll(" (disable with -fno-summary)") catch {}; |
| 494 | ttyconf.setColor(stderr, .Reset) catch {}; | 494 | ttyconf.setColor(stderr, .reset) catch {}; |
| 495 | } | 495 | } |
| 496 | stderr.writeAll("\n") catch {}; | 496 | stderr.writeAll("\n") catch {}; |
| 497 | 497 | ||
| ... | @@ -560,7 +560,7 @@ fn printTreeStep( | ... | @@ -560,7 +560,7 @@ fn printTreeStep( |
| 560 | const first = step_stack.swapRemove(s); | 560 | const first = step_stack.swapRemove(s); |
| 561 | try printPrefix(parent_node, stderr, ttyconf); | 561 | try printPrefix(parent_node, stderr, ttyconf); |
| 562 | 562 | ||
| 563 | if (!first) try ttyconf.setColor(stderr, .Dim); | 563 | if (!first) try ttyconf.setColor(stderr, .dim); |
| 564 | if (parent_node.parent != null) { | 564 | if (parent_node.parent != null) { |
| 565 | if (parent_node.last) { | 565 | if (parent_node.last) { |
| 566 | try stderr.writeAll(switch (ttyconf) { | 566 | try stderr.writeAll(switch (ttyconf) { |
| ... | @@ -586,28 +586,28 @@ fn printTreeStep( | ... | @@ -586,28 +586,28 @@ fn printTreeStep( |
| 586 | .running => unreachable, | 586 | .running => unreachable, |
| 587 | 587 | ||
| 588 | .dependency_failure => { | 588 | .dependency_failure => { |
| 589 | try ttyconf.setColor(stderr, .Dim); | 589 | try ttyconf.setColor(stderr, .dim); |
| 590 | try stderr.writeAll(" transitive failure\n"); | 590 | try stderr.writeAll(" transitive failure\n"); |
| 591 | try ttyconf.setColor(stderr, .Reset); | 591 | try ttyconf.setColor(stderr, .reset); |
| 592 | }, | 592 | }, |
| 593 | 593 | ||
| 594 | .success => { | 594 | .success => { |
| 595 | try ttyconf.setColor(stderr, .Green); | 595 | try ttyconf.setColor(stderr, .green); |
| 596 | if (s.result_cached) { | 596 | if (s.result_cached) { |
| 597 | try stderr.writeAll(" cached"); | 597 | try stderr.writeAll(" cached"); |
| 598 | } else if (s.test_results.test_count > 0) { | 598 | } else if (s.test_results.test_count > 0) { |
| 599 | const pass_count = s.test_results.passCount(); | 599 | const pass_count = s.test_results.passCount(); |
| 600 | try stderr.writer().print(" {d} passed", .{pass_count}); | 600 | try stderr.writer().print(" {d} passed", .{pass_count}); |
| 601 | if (s.test_results.skip_count > 0) { | 601 | if (s.test_results.skip_count > 0) { |
| 602 | try ttyconf.setColor(stderr, .Yellow); | 602 | try ttyconf.setColor(stderr, .yellow); |
| 603 | try stderr.writer().print(" {d} skipped", .{s.test_results.skip_count}); | 603 | try stderr.writer().print(" {d} skipped", .{s.test_results.skip_count}); |
| 604 | } | 604 | } |
| 605 | } else { | 605 | } else { |
| 606 | try stderr.writeAll(" success"); | 606 | try stderr.writeAll(" success"); |
| 607 | } | 607 | } |
| 608 | try ttyconf.setColor(stderr, .Reset); | 608 | try ttyconf.setColor(stderr, .reset); |
| 609 | if (s.result_duration_ns) |ns| { | 609 | if (s.result_duration_ns) |ns| { |
| 610 | try ttyconf.setColor(stderr, .Dim); | 610 | try ttyconf.setColor(stderr, .dim); |
| 611 | if (ns >= std.time.ns_per_min) { | 611 | if (ns >= std.time.ns_per_min) { |
| 612 | try stderr.writer().print(" {d}m", .{ns / std.time.ns_per_min}); | 612 | try stderr.writer().print(" {d}m", .{ns / std.time.ns_per_min}); |
| 613 | } else if (ns >= std.time.ns_per_s) { | 613 | } else if (ns >= std.time.ns_per_s) { |
| ... | @@ -619,11 +619,11 @@ fn printTreeStep( | ... | @@ -619,11 +619,11 @@ fn printTreeStep( |
| 619 | } else { | 619 | } else { |
| 620 | try stderr.writer().print(" {d}ns", .{ns}); | 620 | try stderr.writer().print(" {d}ns", .{ns}); |
| 621 | } | 621 | } |
| 622 | try ttyconf.setColor(stderr, .Reset); | 622 | try ttyconf.setColor(stderr, .reset); |
| 623 | } | 623 | } |
| 624 | if (s.result_peak_rss != 0) { | 624 | if (s.result_peak_rss != 0) { |
| 625 | const rss = s.result_peak_rss; | 625 | const rss = s.result_peak_rss; |
| 626 | try ttyconf.setColor(stderr, .Dim); | 626 | try ttyconf.setColor(stderr, .dim); |
| 627 | if (rss >= 1000_000_000) { | 627 | if (rss >= 1000_000_000) { |
| 628 | try stderr.writer().print(" MaxRSS:{d}G", .{rss / 1000_000_000}); | 628 | try stderr.writer().print(" MaxRSS:{d}G", .{rss / 1000_000_000}); |
| 629 | } else if (rss >= 1000_000) { | 629 | } else if (rss >= 1000_000) { |
| ... | @@ -633,57 +633,57 @@ fn printTreeStep( | ... | @@ -633,57 +633,57 @@ fn printTreeStep( |
| 633 | } else { | 633 | } else { |
| 634 | try stderr.writer().print(" MaxRSS:{d}B", .{rss}); | 634 | try stderr.writer().print(" MaxRSS:{d}B", .{rss}); |
| 635 | } | 635 | } |
| 636 | try ttyconf.setColor(stderr, .Reset); | 636 | try ttyconf.setColor(stderr, .reset); |
| 637 | } | 637 | } |
| 638 | try stderr.writeAll("\n"); | 638 | try stderr.writeAll("\n"); |
| 639 | }, | 639 | }, |
| 640 | 640 | ||
| 641 | .skipped => { | 641 | .skipped => { |
| 642 | try ttyconf.setColor(stderr, .Yellow); | 642 | try ttyconf.setColor(stderr, .yellow); |
| 643 | try stderr.writeAll(" skipped\n"); | 643 | try stderr.writeAll(" skipped\n"); |
| 644 | try ttyconf.setColor(stderr, .Reset); | 644 | try ttyconf.setColor(stderr, .reset); |
| 645 | }, | 645 | }, |
| 646 | 646 | ||
| 647 | .failure => { | 647 | .failure => { |
| 648 | if (s.result_error_bundle.errorMessageCount() > 0) { | 648 | if (s.result_error_bundle.errorMessageCount() > 0) { |
| 649 | try ttyconf.setColor(stderr, .Red); | 649 | try ttyconf.setColor(stderr, .red); |
| 650 | try stderr.writer().print(" {d} errors\n", .{ | 650 | try stderr.writer().print(" {d} errors\n", .{ |
| 651 | s.result_error_bundle.errorMessageCount(), | 651 | s.result_error_bundle.errorMessageCount(), |
| 652 | }); | 652 | }); |
| 653 | try ttyconf.setColor(stderr, .Reset); | 653 | try ttyconf.setColor(stderr, .reset); |
| 654 | } else if (!s.test_results.isSuccess()) { | 654 | } else if (!s.test_results.isSuccess()) { |
| 655 | try stderr.writer().print(" {d}/{d} passed", .{ | 655 | try stderr.writer().print(" {d}/{d} passed", .{ |
| 656 | s.test_results.passCount(), s.test_results.test_count, | 656 | s.test_results.passCount(), s.test_results.test_count, |
| 657 | }); | 657 | }); |
| 658 | if (s.test_results.fail_count > 0) { | 658 | if (s.test_results.fail_count > 0) { |
| 659 | try stderr.writeAll(", "); | 659 | try stderr.writeAll(", "); |
| 660 | try ttyconf.setColor(stderr, .Red); | 660 | try ttyconf.setColor(stderr, .red); |
| 661 | try stderr.writer().print("{d} failed", .{ | 661 | try stderr.writer().print("{d} failed", .{ |
| 662 | s.test_results.fail_count, | 662 | s.test_results.fail_count, |
| 663 | }); | 663 | }); |
| 664 | try ttyconf.setColor(stderr, .Reset); | 664 | try ttyconf.setColor(stderr, .reset); |
| 665 | } | 665 | } |
| 666 | if (s.test_results.skip_count > 0) { | 666 | if (s.test_results.skip_count > 0) { |
| 667 | try stderr.writeAll(", "); | 667 | try stderr.writeAll(", "); |
| 668 | try ttyconf.setColor(stderr, .Yellow); | 668 | try ttyconf.setColor(stderr, .yellow); |
| 669 | try stderr.writer().print("{d} skipped", .{ | 669 | try stderr.writer().print("{d} skipped", .{ |
| 670 | s.test_results.skip_count, | 670 | s.test_results.skip_count, |
| 671 | }); | 671 | }); |
| 672 | try ttyconf.setColor(stderr, .Reset); | 672 | try ttyconf.setColor(stderr, .reset); |
| 673 | } | 673 | } |
| 674 | if (s.test_results.leak_count > 0) { | 674 | if (s.test_results.leak_count > 0) { |
| 675 | try stderr.writeAll(", "); | 675 | try stderr.writeAll(", "); |
| 676 | try ttyconf.setColor(stderr, .Red); | 676 | try ttyconf.setColor(stderr, .red); |
| 677 | try stderr.writer().print("{d} leaked", .{ | 677 | try stderr.writer().print("{d} leaked", .{ |
| 678 | s.test_results.leak_count, | 678 | s.test_results.leak_count, |
| 679 | }); | 679 | }); |
| 680 | try ttyconf.setColor(stderr, .Reset); | 680 | try ttyconf.setColor(stderr, .reset); |
| 681 | } | 681 | } |
| 682 | try stderr.writeAll("\n"); | 682 | try stderr.writeAll("\n"); |
| 683 | } else { | 683 | } else { |
| 684 | try ttyconf.setColor(stderr, .Red); | 684 | try ttyconf.setColor(stderr, .red); |
| 685 | try stderr.writeAll(" failure\n"); | 685 | try stderr.writeAll(" failure\n"); |
| 686 | try ttyconf.setColor(stderr, .Reset); | 686 | try ttyconf.setColor(stderr, .reset); |
| 687 | } | 687 | } |
| 688 | }, | 688 | }, |
| 689 | } | 689 | } |
| ... | @@ -703,7 +703,7 @@ fn printTreeStep( | ... | @@ -703,7 +703,7 @@ fn printTreeStep( |
| 703 | s.dependencies.items.len, | 703 | s.dependencies.items.len, |
| 704 | }); | 704 | }); |
| 705 | } | 705 | } |
| 706 | try ttyconf.setColor(stderr, .Reset); | 706 | try ttyconf.setColor(stderr, .reset); |
| 707 | } | 707 | } |
| 708 | } | 708 | } |
| 709 | 709 | ||
| ... | @@ -819,13 +819,13 @@ fn workerMakeOneStep( | ... | @@ -819,13 +819,13 @@ fn workerMakeOneStep( |
| 819 | for (s.result_error_msgs.items) |msg| { | 819 | for (s.result_error_msgs.items) |msg| { |
| 820 | // Sometimes it feels like you just can't catch a break. Finally, | 820 | // Sometimes it feels like you just can't catch a break. Finally, |
| 821 | // with Zig, you can. | 821 | // with Zig, you can. |
| 822 | ttyconf.setColor(stderr, .Bold) catch break; | 822 | ttyconf.setColor(stderr, .bold) catch break; |
| 823 | stderr.writeAll(s.owner.dep_prefix) catch break; | 823 | stderr.writeAll(s.owner.dep_prefix) catch break; |
| 824 | stderr.writeAll(s.name) catch break; | 824 | stderr.writeAll(s.name) catch break; |
| 825 | stderr.writeAll(": ") catch break; | 825 | stderr.writeAll(": ") catch break; |
| 826 | ttyconf.setColor(stderr, .Red) catch break; | 826 | ttyconf.setColor(stderr, .red) catch break; |
| 827 | stderr.writeAll("error: ") catch break; | 827 | stderr.writeAll("error: ") catch break; |
| 828 | ttyconf.setColor(stderr, .Reset) catch break; | 828 | ttyconf.setColor(stderr, .reset) catch break; |
| 829 | stderr.writeAll(msg) catch break; | 829 | stderr.writeAll(msg) catch break; |
| 830 | stderr.writeAll("\n") catch break; | 830 | stderr.writeAll("\n") catch break; |
| 831 | } | 831 | } |
lib/std/Build.zig+6-6| ... | @@ -1713,9 +1713,9 @@ fn dumpBadGetPathHelp( | ... | @@ -1713,9 +1713,9 @@ fn dumpBadGetPathHelp( |
| 1713 | }); | 1713 | }); |
| 1714 | 1714 | ||
| 1715 | const tty_config = std.debug.detectTTYConfig(stderr); | 1715 | const tty_config = std.debug.detectTTYConfig(stderr); |
| 1716 | tty_config.setColor(w, .Red) catch {}; | 1716 | tty_config.setColor(w, .red) catch {}; |
| 1717 | try stderr.writeAll(" The step was created by this stack trace:\n"); | 1717 | try stderr.writeAll(" The step was created by this stack trace:\n"); |
| 1718 | tty_config.setColor(w, .Reset) catch {}; | 1718 | tty_config.setColor(w, .reset) catch {}; |
| 1719 | 1719 | ||
| 1720 | const debug_info = std.debug.getSelfDebugInfo() catch |err| { | 1720 | const debug_info = std.debug.getSelfDebugInfo() catch |err| { |
| 1721 | try w.print("Unable to dump stack trace: Unable to open debug info: {s}\n", .{@errorName(err)}); | 1721 | try w.print("Unable to dump stack trace: Unable to open debug info: {s}\n", .{@errorName(err)}); |
| ... | @@ -1727,9 +1727,9 @@ fn dumpBadGetPathHelp( | ... | @@ -1727,9 +1727,9 @@ fn dumpBadGetPathHelp( |
| 1727 | return; | 1727 | return; |
| 1728 | }; | 1728 | }; |
| 1729 | if (asking_step) |as| { | 1729 | if (asking_step) |as| { |
| 1730 | tty_config.setColor(w, .Red) catch {}; | 1730 | tty_config.setColor(w, .red) catch {}; |
| 1731 | try stderr.writeAll(" The step that is missing a dependency on the above step was created by this stack trace:\n"); | 1731 | try stderr.writeAll(" The step that is missing a dependency on the above step was created by this stack trace:\n"); |
| 1732 | tty_config.setColor(w, .Reset) catch {}; | 1732 | tty_config.setColor(w, .reset) catch {}; |
| 1733 | 1733 | ||
| 1734 | std.debug.writeStackTrace(as.getStackTrace(), w, ally, debug_info, tty_config) catch |err| { | 1734 | std.debug.writeStackTrace(as.getStackTrace(), w, ally, debug_info, tty_config) catch |err| { |
| 1735 | try stderr.writer().print("Unable to dump stack trace: {s}\n", .{@errorName(err)}); | 1735 | try stderr.writer().print("Unable to dump stack trace: {s}\n", .{@errorName(err)}); |
| ... | @@ -1737,9 +1737,9 @@ fn dumpBadGetPathHelp( | ... | @@ -1737,9 +1737,9 @@ fn dumpBadGetPathHelp( |
| 1737 | }; | 1737 | }; |
| 1738 | } | 1738 | } |
| 1739 | 1739 | ||
| 1740 | tty_config.setColor(w, .Red) catch {}; | 1740 | tty_config.setColor(w, .red) catch {}; |
| 1741 | try stderr.writeAll(" Hope that helps. Proceeding to panic.\n"); | 1741 | try stderr.writeAll(" Hope that helps. Proceeding to panic.\n"); |
| 1742 | tty_config.setColor(w, .Reset) catch {}; | 1742 | tty_config.setColor(w, .reset) catch {}; |
| 1743 | } | 1743 | } |
| 1744 | 1744 | ||
| 1745 | /// Allocates a new string for assigning a value to a named macro. | 1745 | /// Allocates a new string for assigning a value to a named macro. |
lib/std/debug.zig+31-31| ... | @@ -421,9 +421,9 @@ pub fn writeStackTrace( | ... | @@ -421,9 +421,9 @@ pub fn writeStackTrace( |
| 421 | if (stack_trace.index > stack_trace.instruction_addresses.len) { | 421 | if (stack_trace.index > stack_trace.instruction_addresses.len) { |
| 422 | const dropped_frames = stack_trace.index - stack_trace.instruction_addresses.len; | 422 | const dropped_frames = stack_trace.index - stack_trace.instruction_addresses.len; |
| 423 | 423 | ||
| 424 | tty_config.setColor(out_stream, .Bold) catch {}; | 424 | tty_config.setColor(out_stream, .bold) catch {}; |
| 425 | try out_stream.print("({d} additional stack frames skipped...)\n", .{dropped_frames}); | 425 | try out_stream.print("({d} additional stack frames skipped...)\n", .{dropped_frames}); |
| 426 | tty_config.setColor(out_stream, .Reset) catch {}; | 426 | tty_config.setColor(out_stream, .reset) catch {}; |
| 427 | } | 427 | } |
| 428 | } | 428 | } |
| 429 | 429 | ||
| ... | @@ -655,14 +655,14 @@ pub fn writeCurrentStackTraceWindows( | ... | @@ -655,14 +655,14 @@ pub fn writeCurrentStackTraceWindows( |
| 655 | /// for debugging purposes, such as coloring text, etc. | 655 | /// for debugging purposes, such as coloring text, etc. |
| 656 | pub const TTY = struct { | 656 | pub const TTY = struct { |
| 657 | pub const Color = enum { | 657 | pub const Color = enum { |
| 658 | Red, | 658 | red, |
| 659 | Green, | 659 | green, |
| 660 | Yellow, | 660 | yellow, |
| 661 | Cyan, | 661 | cyan, |
| 662 | White, | 662 | white, |
| 663 | Dim, | 663 | dim, |
| 664 | Bold, | 664 | bold, |
| 665 | Reset, | 665 | reset, |
| 666 | }; | 666 | }; |
| 667 | 667 | ||
| 668 | pub const Config = union(enum) { | 668 | pub const Config = union(enum) { |
| ... | @@ -680,26 +680,26 @@ pub const TTY = struct { | ... | @@ -680,26 +680,26 @@ pub const TTY = struct { |
| 680 | .no_color => return, | 680 | .no_color => return, |
| 681 | .escape_codes => { | 681 | .escape_codes => { |
| 682 | const color_string = switch (color) { | 682 | const color_string = switch (color) { |
| 683 | .Red => "\x1b[31;1m", | 683 | .red => "\x1b[31;1m", |
| 684 | .Green => "\x1b[32;1m", | 684 | .green => "\x1b[32;1m", |
| 685 | .Yellow => "\x1b[33;1m", | 685 | .yellow => "\x1b[33;1m", |
| 686 | .Cyan => "\x1b[36;1m", | 686 | .cyan => "\x1b[36;1m", |
| 687 | .White => "\x1b[37;1m", | 687 | .white => "\x1b[37;1m", |
| 688 | .Bold => "\x1b[1m", | 688 | .bold => "\x1b[1m", |
| 689 | .Dim => "\x1b[2m", | 689 | .dim => "\x1b[2m", |
| 690 | .Reset => "\x1b[0m", | 690 | .reset => "\x1b[0m", |
| 691 | }; | 691 | }; |
| 692 | try out_stream.writeAll(color_string); | 692 | try out_stream.writeAll(color_string); |
| 693 | }, | 693 | }, |
| 694 | .windows_api => |ctx| if (native_os == .windows) { | 694 | .windows_api => |ctx| if (native_os == .windows) { |
| 695 | const attributes = switch (color) { | 695 | const attributes = switch (color) { |
| 696 | .Red => windows.FOREGROUND_RED | windows.FOREGROUND_INTENSITY, | 696 | .red => windows.FOREGROUND_RED | windows.FOREGROUND_INTENSITY, |
| 697 | .Green => windows.FOREGROUND_GREEN | windows.FOREGROUND_INTENSITY, | 697 | .green => windows.FOREGROUND_GREEN | windows.FOREGROUND_INTENSITY, |
| 698 | .Yellow => windows.FOREGROUND_RED | windows.FOREGROUND_GREEN | windows.FOREGROUND_INTENSITY, | 698 | .yellow => windows.FOREGROUND_RED | windows.FOREGROUND_GREEN | windows.FOREGROUND_INTENSITY, |
| 699 | .Cyan => windows.FOREGROUND_GREEN | windows.FOREGROUND_BLUE | windows.FOREGROUND_INTENSITY, | 699 | .cyan => windows.FOREGROUND_GREEN | windows.FOREGROUND_BLUE | windows.FOREGROUND_INTENSITY, |
| 700 | .White, .Bold => windows.FOREGROUND_RED | windows.FOREGROUND_GREEN | windows.FOREGROUND_BLUE | windows.FOREGROUND_INTENSITY, | 700 | .white, .bold => windows.FOREGROUND_RED | windows.FOREGROUND_GREEN | windows.FOREGROUND_BLUE | windows.FOREGROUND_INTENSITY, |
| 701 | .Dim => windows.FOREGROUND_INTENSITY, | 701 | .dim => windows.FOREGROUND_INTENSITY, |
| 702 | .Reset => ctx.reset_attributes, | 702 | .reset => ctx.reset_attributes, |
| 703 | }; | 703 | }; |
| 704 | try windows.SetConsoleTextAttribute(ctx.handle, attributes); | 704 | try windows.SetConsoleTextAttribute(ctx.handle, attributes); |
| 705 | } else { | 705 | } else { |
| ... | @@ -831,7 +831,7 @@ fn printLineInfo( | ... | @@ -831,7 +831,7 @@ fn printLineInfo( |
| 831 | comptime printLineFromFile: anytype, | 831 | comptime printLineFromFile: anytype, |
| 832 | ) !void { | 832 | ) !void { |
| 833 | nosuspend { | 833 | nosuspend { |
| 834 | try tty_config.setColor(out_stream, .Bold); | 834 | try tty_config.setColor(out_stream, .bold); |
| 835 | 835 | ||
| 836 | if (line_info) |*li| { | 836 | if (line_info) |*li| { |
| 837 | try out_stream.print("{s}:{d}:{d}", .{ li.file_name, li.line, li.column }); | 837 | try out_stream.print("{s}:{d}:{d}", .{ li.file_name, li.line, li.column }); |
| ... | @@ -839,11 +839,11 @@ fn printLineInfo( | ... | @@ -839,11 +839,11 @@ fn printLineInfo( |
| 839 | try out_stream.writeAll("???:?:?"); | 839 | try out_stream.writeAll("???:?:?"); |
| 840 | } | 840 | } |
| 841 | 841 | ||
| 842 | try tty_config.setColor(out_stream, .Reset); | 842 | try tty_config.setColor(out_stream, .reset); |
| 843 | try out_stream.writeAll(": "); | 843 | try out_stream.writeAll(": "); |
| 844 | try tty_config.setColor(out_stream, .Dim); | 844 | try tty_config.setColor(out_stream, .dim); |
| 845 | try out_stream.print("0x{x} in {s} ({s})", .{ address, symbol_name, compile_unit_name }); | 845 | try out_stream.print("0x{x} in {s} ({s})", .{ address, symbol_name, compile_unit_name }); |
| 846 | try tty_config.setColor(out_stream, .Reset); | 846 | try tty_config.setColor(out_stream, .reset); |
| 847 | try out_stream.writeAll("\n"); | 847 | try out_stream.writeAll("\n"); |
| 848 | 848 | ||
| 849 | // Show the matching source code line if possible | 849 | // Show the matching source code line if possible |
| ... | @@ -854,9 +854,9 @@ fn printLineInfo( | ... | @@ -854,9 +854,9 @@ fn printLineInfo( |
| 854 | const space_needed = @intCast(usize, li.column - 1); | 854 | const space_needed = @intCast(usize, li.column - 1); |
| 855 | 855 | ||
| 856 | try out_stream.writeByteNTimes(' ', space_needed); | 856 | try out_stream.writeByteNTimes(' ', space_needed); |
| 857 | try tty_config.setColor(out_stream, .Green); | 857 | try tty_config.setColor(out_stream, .green); |
| 858 | try out_stream.writeAll("^"); | 858 | try out_stream.writeAll("^"); |
| 859 | try tty_config.setColor(out_stream, .Reset); | 859 | try tty_config.setColor(out_stream, .reset); |
| 860 | } | 860 | } |
| 861 | try out_stream.writeAll("\n"); | 861 | try out_stream.writeAll("\n"); |
| 862 | } else |err| switch (err) { | 862 | } else |err| switch (err) { |
lib/std/testing.zig+4-4| ... | @@ -387,9 +387,9 @@ fn SliceDiffer(comptime T: type) type { | ... | @@ -387,9 +387,9 @@ fn SliceDiffer(comptime T: type) type { |
| 387 | for (self.expected, 0..) |value, i| { | 387 | for (self.expected, 0..) |value, i| { |
| 388 | var full_index = self.start_index + i; | 388 | var full_index = self.start_index + i; |
| 389 | const diff = if (i < self.actual.len) !std.meta.eql(self.actual[i], value) else true; | 389 | const diff = if (i < self.actual.len) !std.meta.eql(self.actual[i], value) else true; |
| 390 | if (diff) try self.ttyconf.setColor(writer, .Red); | 390 | if (diff) try self.ttyconf.setColor(writer, .red); |
| 391 | try writer.print("[{}]: {any}\n", .{ full_index, value }); | 391 | try writer.print("[{}]: {any}\n", .{ full_index, value }); |
| 392 | if (diff) try self.ttyconf.setColor(writer, .Reset); | 392 | if (diff) try self.ttyconf.setColor(writer, .reset); |
| 393 | } | 393 | } |
| 394 | } | 394 | } |
| 395 | }; | 395 | }; |
| ... | @@ -427,9 +427,9 @@ const BytesDiffer = struct { | ... | @@ -427,9 +427,9 @@ const BytesDiffer = struct { |
| 427 | } | 427 | } |
| 428 | 428 | ||
| 429 | fn writeByteDiff(self: BytesDiffer, writer: anytype, comptime fmt: []const u8, byte: u8, diff: bool) !void { | 429 | fn writeByteDiff(self: BytesDiffer, writer: anytype, comptime fmt: []const u8, byte: u8, diff: bool) !void { |
| 430 | if (diff) try self.ttyconf.setColor(writer, .Red); | 430 | if (diff) try self.ttyconf.setColor(writer, .red); |
| 431 | try writer.print(fmt, .{byte}); | 431 | try writer.print(fmt, .{byte}); |
| 432 | if (diff) try self.ttyconf.setColor(writer, .Reset); | 432 | if (diff) try self.ttyconf.setColor(writer, .reset); |
| 433 | } | 433 | } |
| 434 | 434 | ||
| 435 | const ChunkIterator = struct { | 435 | const ChunkIterator = struct { |
lib/std/zig/ErrorBundle.zig+16-16| ... | @@ -163,7 +163,7 @@ pub fn renderToStdErr(eb: ErrorBundle, options: RenderOptions) void { | ... | @@ -163,7 +163,7 @@ pub fn renderToStdErr(eb: ErrorBundle, options: RenderOptions) void { |
| 163 | 163 | ||
| 164 | pub fn renderToWriter(eb: ErrorBundle, options: RenderOptions, writer: anytype) anyerror!void { | 164 | pub fn renderToWriter(eb: ErrorBundle, options: RenderOptions, writer: anytype) anyerror!void { |
| 165 | for (eb.getMessages()) |err_msg| { | 165 | for (eb.getMessages()) |err_msg| { |
| 166 | try renderErrorMessageToWriter(eb, options, err_msg, writer, "error", .Red, 0); | 166 | try renderErrorMessageToWriter(eb, options, err_msg, writer, "error", .red, 0); |
| 167 | } | 167 | } |
| 168 | 168 | ||
| 169 | if (options.include_log_text) { | 169 | if (options.include_log_text) { |
| ... | @@ -191,7 +191,7 @@ fn renderErrorMessageToWriter( | ... | @@ -191,7 +191,7 @@ fn renderErrorMessageToWriter( |
| 191 | if (err_msg.src_loc != .none) { | 191 | if (err_msg.src_loc != .none) { |
| 192 | const src = eb.extraData(SourceLocation, @enumToInt(err_msg.src_loc)); | 192 | const src = eb.extraData(SourceLocation, @enumToInt(err_msg.src_loc)); |
| 193 | try counting_stderr.writeByteNTimes(' ', indent); | 193 | try counting_stderr.writeByteNTimes(' ', indent); |
| 194 | try ttyconf.setColor(stderr, .Bold); | 194 | try ttyconf.setColor(stderr, .bold); |
| 195 | try counting_stderr.print("{s}:{d}:{d}: ", .{ | 195 | try counting_stderr.print("{s}:{d}:{d}: ", .{ |
| 196 | eb.nullTerminatedString(src.data.src_path), | 196 | eb.nullTerminatedString(src.data.src_path), |
| 197 | src.data.line + 1, | 197 | src.data.line + 1, |
| ... | @@ -203,17 +203,17 @@ fn renderErrorMessageToWriter( | ... | @@ -203,17 +203,17 @@ fn renderErrorMessageToWriter( |
| 203 | // This is the length of the part before the error message: | 203 | // This is the length of the part before the error message: |
| 204 | // e.g. "file.zig:4:5: error: " | 204 | // e.g. "file.zig:4:5: error: " |
| 205 | const prefix_len = @intCast(usize, counting_stderr.context.bytes_written); | 205 | const prefix_len = @intCast(usize, counting_stderr.context.bytes_written); |
| 206 | try ttyconf.setColor(stderr, .Reset); | 206 | try ttyconf.setColor(stderr, .reset); |
| 207 | try ttyconf.setColor(stderr, .Bold); | 207 | try ttyconf.setColor(stderr, .bold); |
| 208 | if (err_msg.count == 1) { | 208 | if (err_msg.count == 1) { |
| 209 | try writeMsg(eb, err_msg, stderr, prefix_len); | 209 | try writeMsg(eb, err_msg, stderr, prefix_len); |
| 210 | try stderr.writeByte('\n'); | 210 | try stderr.writeByte('\n'); |
| 211 | } else { | 211 | } else { |
| 212 | try writeMsg(eb, err_msg, stderr, prefix_len); | 212 | try writeMsg(eb, err_msg, stderr, prefix_len); |
| 213 | try ttyconf.setColor(stderr, .Dim); | 213 | try ttyconf.setColor(stderr, .dim); |
| 214 | try stderr.print(" ({d} times)\n", .{err_msg.count}); | 214 | try stderr.print(" ({d} times)\n", .{err_msg.count}); |
| 215 | } | 215 | } |
| 216 | try ttyconf.setColor(stderr, .Reset); | 216 | try ttyconf.setColor(stderr, .reset); |
| 217 | if (src.data.source_line != 0 and options.include_source_line) { | 217 | if (src.data.source_line != 0 and options.include_source_line) { |
| 218 | const line = eb.nullTerminatedString(src.data.source_line); | 218 | const line = eb.nullTerminatedString(src.data.source_line); |
| 219 | for (line) |b| switch (b) { | 219 | for (line) |b| switch (b) { |
| ... | @@ -226,19 +226,19 @@ fn renderErrorMessageToWriter( | ... | @@ -226,19 +226,19 @@ fn renderErrorMessageToWriter( |
| 226 | // -1 since span.main includes the caret | 226 | // -1 since span.main includes the caret |
| 227 | const after_caret = src.data.span_end - src.data.span_main -| 1; | 227 | const after_caret = src.data.span_end - src.data.span_main -| 1; |
| 228 | try stderr.writeByteNTimes(' ', src.data.column - before_caret); | 228 | try stderr.writeByteNTimes(' ', src.data.column - before_caret); |
| 229 | try ttyconf.setColor(stderr, .Green); | 229 | try ttyconf.setColor(stderr, .green); |
| 230 | try stderr.writeByteNTimes('~', before_caret); | 230 | try stderr.writeByteNTimes('~', before_caret); |
| 231 | try stderr.writeByte('^'); | 231 | try stderr.writeByte('^'); |
| 232 | try stderr.writeByteNTimes('~', after_caret); | 232 | try stderr.writeByteNTimes('~', after_caret); |
| 233 | try stderr.writeByte('\n'); | 233 | try stderr.writeByte('\n'); |
| 234 | try ttyconf.setColor(stderr, .Reset); | 234 | try ttyconf.setColor(stderr, .reset); |
| 235 | } | 235 | } |
| 236 | for (eb.getNotes(err_msg_index)) |note| { | 236 | for (eb.getNotes(err_msg_index)) |note| { |
| 237 | try renderErrorMessageToWriter(eb, options, note, stderr, "note", .Cyan, indent); | 237 | try renderErrorMessageToWriter(eb, options, note, stderr, "note", .cyan, indent); |
| 238 | } | 238 | } |
| 239 | if (src.data.reference_trace_len > 0 and options.include_reference_trace) { | 239 | if (src.data.reference_trace_len > 0 and options.include_reference_trace) { |
| 240 | try ttyconf.setColor(stderr, .Reset); | 240 | try ttyconf.setColor(stderr, .reset); |
| 241 | try ttyconf.setColor(stderr, .Dim); | 241 | try ttyconf.setColor(stderr, .dim); |
| 242 | try stderr.print("referenced by:\n", .{}); | 242 | try stderr.print("referenced by:\n", .{}); |
| 243 | var ref_index = src.end; | 243 | var ref_index = src.end; |
| 244 | for (0..src.data.reference_trace_len) |_| { | 244 | for (0..src.data.reference_trace_len) |_| { |
| ... | @@ -266,25 +266,25 @@ fn renderErrorMessageToWriter( | ... | @@ -266,25 +266,25 @@ fn renderErrorMessageToWriter( |
| 266 | } | 266 | } |
| 267 | } | 267 | } |
| 268 | try stderr.writeByte('\n'); | 268 | try stderr.writeByte('\n'); |
| 269 | try ttyconf.setColor(stderr, .Reset); | 269 | try ttyconf.setColor(stderr, .reset); |
| 270 | } | 270 | } |
| 271 | } else { | 271 | } else { |
| 272 | try ttyconf.setColor(stderr, color); | 272 | try ttyconf.setColor(stderr, color); |
| 273 | try stderr.writeByteNTimes(' ', indent); | 273 | try stderr.writeByteNTimes(' ', indent); |
| 274 | try stderr.writeAll(kind); | 274 | try stderr.writeAll(kind); |
| 275 | try stderr.writeAll(": "); | 275 | try stderr.writeAll(": "); |
| 276 | try ttyconf.setColor(stderr, .Reset); | 276 | try ttyconf.setColor(stderr, .reset); |
| 277 | const msg = eb.nullTerminatedString(err_msg.msg); | 277 | const msg = eb.nullTerminatedString(err_msg.msg); |
| 278 | if (err_msg.count == 1) { | 278 | if (err_msg.count == 1) { |
| 279 | try stderr.print("{s}\n", .{msg}); | 279 | try stderr.print("{s}\n", .{msg}); |
| 280 | } else { | 280 | } else { |
| 281 | try stderr.print("{s}", .{msg}); | 281 | try stderr.print("{s}", .{msg}); |
| 282 | try ttyconf.setColor(stderr, .Dim); | 282 | try ttyconf.setColor(stderr, .dim); |
| 283 | try stderr.print(" ({d} times)\n", .{err_msg.count}); | 283 | try stderr.print(" ({d} times)\n", .{err_msg.count}); |
| 284 | } | 284 | } |
| 285 | try ttyconf.setColor(stderr, .Reset); | 285 | try ttyconf.setColor(stderr, .reset); |
| 286 | for (eb.getNotes(err_msg_index)) |note| { | 286 | for (eb.getNotes(err_msg_index)) |note| { |
| 287 | try renderErrorMessageToWriter(eb, options, note, stderr, "note", .Cyan, indent + 4); | 287 | try renderErrorMessageToWriter(eb, options, note, stderr, "note", .cyan, indent + 4); |
| 288 | } | 288 | } |
| 289 | } | 289 | } |
| 290 | } | 290 | } |