From a49db374b621d9c19da2a8e2da293c8095983304 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Mon, 21 Sep 2026 16:23:34 +0000 Subject: [PATCH] ci: Disable library backtrace capture in macOS test jobs (#64555) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Based on https://github.com/zed-industries/zed/pull/64464#issuecomment-5763255028 With `RUST_BACKTRACE=1` set, `anyhow` captures a backtrace for every error it constructs; on macOS this costs ~30ms per error, on Linux ~µs. `Project::test` alone hits several such errors during setup (`canonicalize`/`load` of the non-existent global `tasks.json` and `debug.json`, worktree creation, buffer open), adding ~0.8s of fixed cost per test on macOS. `RUST_LIB_BACKTRACE=0` is checked by std before `RUST_BACKTRACE`, so panics keep their backtraces while library error captures stop. Set only on the macOS test jobs (`run_tests.yml`, `release.yml`), since Linux and Windows pay nothing for the captures and keep the error-origin backtraces in failure output. Measured with `cargo nextest run -p editor --lib`: macOS 119s → 72s, Linux 78s → 76s (noise). Trade-off on macOS: a failing `.unwrap()` on an `anyhow::Error` in CI output loses the backtrace of where the error was constructed; the panic backtrace at the unwrap site is unaffected. Release Notes: - N/A --- .github/workflows/release.yml | 2 ++ .github/workflows/run_tests.yml | 2 ++ tooling/xtask/src/tasks/workflows/run_tests.rs | 3 +++ 3 files changed, 7 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 58d4eeaaa6..585280568f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,6 +14,8 @@ jobs: run_tests_mac: if: (github.repository_owner == 'zed-industries' || github.repository_owner == 'zed-extensions') runs-on: namespace-profile-mac-large + env: + RUST_LIB_BACKTRACE: '0' steps: - name: steps::checkout_repo uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index 4b796a5582..3babc1e5c8 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -444,6 +444,8 @@ jobs: - check_style if: needs.orchestrate.outputs.run_tests == 'true' && github.event_name != 'merge_group' runs-on: namespace-profile-mac-large + env: + RUST_LIB_BACKTRACE: '0' steps: - name: steps::checkout_repo uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd diff --git a/tooling/xtask/src/tasks/workflows/run_tests.rs b/tooling/xtask/src/tasks/workflows/run_tests.rs index e93358b5fe..8b7c7d5a04 100644 --- a/tooling/xtask/src/tasks/workflows/run_tests.rs +++ b/tooling/xtask/src/tasks/workflows/run_tests.rs @@ -677,6 +677,9 @@ fn run_platform_tests_impl(platform: Platform, filter_packages: bool, harden: bo name: format!("run_tests_{platform}"), job: release_job(&[]) .runs_on(runner) + .when(platform == Platform::Mac, |job| { + job.add_env(("RUST_LIB_BACKTRACE", 0)) + }) .when(platform == Platform::Linux, |job| { job.add_service( "postgres",