From 9af936debb3d8f03bd26b325a8f21b94dd8af767 Mon Sep 17 00:00:00 2001 From: jinmay Date: Mon, 20 Jul 2026 13:42:33 +0900 Subject: [PATCH] ci: use `build.warnings` instead of `RUSTFLAGS=-D warnings` --- .github/workflows/build.yml | 5 ++++- noxfile.py | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5615f07c4cb..60e91422fec 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -135,5 +135,8 @@ jobs: env: CARGO_TERM_VERBOSE: ${{ inputs.verbose }} RUST_BACKTRACE: 1 - RUSTFLAGS: "-D warnings" + # `build.warnings` avoids the cache-busting from `RUSTFLAGS`; respected on + # Cargo 1.97+ only (MSRV jobs fall back to warn). rustdoc isn't covered by + # it, so RUSTDOCFLAGS stays. + CARGO_BUILD_WARNINGS: deny RUSTDOCFLAGS: "-D warnings" diff --git a/noxfile.py b/noxfile.py index 8553b24739f..636238a27f3 100644 --- a/noxfile.py +++ b/noxfile.py @@ -1665,10 +1665,10 @@ def check_feature_powerset(session: nox.Session): *abi3t_version_features, ] - # deny warnings + # deny warnings; `build.warnings` avoids the cache-busting from `RUSTFLAGS` + # and is respected on Cargo 1.97+ only (MSRV falls back to warn). env = os.environ.copy() - rust_flags = env.get("RUSTFLAGS", "") - env["RUSTFLAGS"] = f"{rust_flags} -Dwarnings" + env["CARGO_BUILD_WARNINGS"] = "deny" subcommand = "hack" if "minimal-versions" in session.posargs: