╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ error_traces.zig ─────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭ find file ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╮ ╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │ │ │http│ ssh │ │ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╯ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
573 .target = target, 574 .name = "error union switch with call operand", 575 .source = 576 \\pub fn main() !void { 577 \\ try foo(); 578 \\ return error.TheSkyIsFalling; 579 \\} 580 \\ 581 \\noinline fn failure() error{ Fatal, NonFatal }!void { 582 \\ return error.NonFatal; 583 \\} 584 \\ 585 \\fn foo() error{Fatal}!void { 586 \\ return failure() catch |err| switch (err) { 587 \\ error.Fatal => return error.Fatal, 588 \\ error.NonFatal => return, 589 \\ }; 590 \\} 591 , 592 .expect_error = "TheSkyIsFalling", 593 .expect_trace = 594 \\source.zig:3:5: [address] in main 595 \\ return error.TheSkyIsFalling; 596 \\ ^ 597 , 598 .disable_trace_optimized = &.{ 599 .{ .x86_64, .freebsd }, 600 .{ .x86_64, .netbsd }, 601 .{ .x86_64, .linux }, 602 .{ .x86, .linux }, 603 .{ .aarch64, .freebsd }, 604 .{ .aarch64, .netbsd }, 605 .{ .aarch64, .linux }, 606 .{ .loongarch64, .linux }, 607 .{ .powerpc64le, .linux }, 608 .{ .riscv64, .linux }, 609 .{ .s390x, .linux }, 610 .{ .x86_64, .openbsd }, 611 .{ .x86_64, .windows }, 612 .{ .x86, .windows }, 613 .{ .x86_64, .macos }, 614 .{ .aarch64, .macos }, 615 }, 616 }); 617 618 cases.addCase(.{ 619 .params = params, 620 .target = target, 621 .name = "trace through inline call", 622 // The main function has two inline calls to ensure 623 // that inlinees in PDBs are properly deduplicated. 624 .source = 625 \\pub fn main() !void { 626 \\ try foo(false); 627 \\ try foo(true); 628 \\} 629 \\inline fn foo(b: bool) !void { 630 \\ if (b) try bar(); 631 \\} 632 \\fn bar() !void { 633 \\ return error.ThisIsSoSad; 634 \\} 635 , 636 .expect_error = "ThisIsSoSad", 637 .expect_trace = switch (target.os.tag) { 638 // LLVM doesn't emit column info in the binary annotations for inlinee callees in PDBs, 639 // so our expected result is slightly different for Windows than on other operating 640 // systems. 641 .windows => 642 \\source.zig:9:5: [address] in bar 643 \\ return error.ThisIsSoSad; 644 \\ ^ 645 \\source.zig:6: [address] in foo 646 \\ if (b) try bar(); 647 \\ 648 \\source.zig:3:5: [address] in main 649 \\ try foo(true); 650 \\ ^ 651 , 652 else => 653 \\source.zig:9:5: [address] in bar 654 \\ return error.ThisIsSoSad; 655 \\ ^ 656 \\source.zig:6:12: [address] in foo 657 \\ if (b) try bar(); 658 \\ ^ 659 \\source.zig:3:5: [address] in main 660 \\ try foo(true); 661 \\ ^ 662 , 663 }, 664 .disable_trace_optimized = &.{ 665 .{ .x86_64, .freebsd }, 666 .{ .x86_64, .netbsd }, 667 .{ .x86_64, .linux }, 668 .{ .x86, .linux }, 669 .{ .aarch64, .freebsd }, 670 .{ .aarch64, .netbsd }, 671 .{ .aarch64, .openbsd }, 672 .{ .aarch64, .linux }, 673 .{ .loongarch64, .linux }, 674 .{ .powerpc64le, .linux }, 675 .{ .riscv64, .linux }, 676 .{ .s390x, .linux }, 677 .{ .x86_64, .openbsd }, 678 .{ .x86_64, .windows }, 679 .{ .x86, .windows }, 680 .{ .x86_64, .macos }, 681 .{ .aarch64, .macos }, 682 }, 683 }); 684 } 685