ci: migrate lint-warning gate from RUSTFLAGS to build.warnings - #5891
Merged
Conversation
Replace the global RUSTFLAGS="-D warnings" CI env var with Cargo's native build.warnings = "deny" (committed .cargo/config.toml), stabilized in Rust 1.97. Unlike RUSTFLAGS, toggling build.warnings does not change rustc's invocation fingerprint, so it no longer forces a full recompile of unchanged units when switching between a plain build and a warnings-denied one. build.warnings turned out wider than RUSTFLAGS: it independently catches rustdoc and clippy lints, not just rustc build warnings. This surfaced 37 pre-existing rustdoc warnings across 10 crates that would have newly failed the rustdoc job; both the coverage and rustdoc jobs now opt out via a job-local CARGO_BUILD_WARNINGS=allow override, preserving their exact pre-migration enforcement scope. Closes #5873
bug-ops
force-pushed
the
feat/issue-5873/migrate-lint-warning-ci-gate
branch
from
July 10, 2026 17:58
16b9b01 to
0bce0ba
Compare
bug-ops
enabled auto-merge (squash)
July 10, 2026 17:58
This was referenced Jul 10, 2026
Closed
bug-ops
added a commit
that referenced
this pull request
Jul 10, 2026
Allow the linker_messages rustc lint via [workspace.lints.rust] so plain cargo build/run succeeds on macOS/arm64, where build.warnings = "deny" (.cargo/config.toml, #5891) unconditionally denies Apple ld's eh_frame section-size warning. Fix 39 pre-existing rustdoc private_intra_doc_links/ redundant_explicit_links warnings across 11 crates, surfaced by the same migration widening the local rustdoc pre-commit gate beyond what it enforced pre-#5891. Tighten ci.yml's rustdoc job RUSTDOCFLAGS to deny both lint classes explicitly so the cleanup has a standing regression guardrail in CI and local dev, not just a one-time sweep. Closes #5894, #5895
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
RUSTFLAGS="-D warnings"CI env var with Cargo's nativebuild.warnings = "deny"(new committed.cargo/config.toml), stabilized in Rust 1.97 (cargo PR feat(compile): Stabilizebuild.warningsrust-lang/cargo#16796). UnlikeRUSTFLAGS, togglingbuild.warningsdoes not change rustc's invocation fingerprint, so it no longer forces a full recompile of unchanged units when switching between a plain build and a warnings-denied one — verified locally viacargo build -vfingerprint comparison..local/specs/047-cargo-build-warnings-migration/spec.md) confirmed 100% coverage parity for the warning classes the previous gate caught (unused imports, dead code, unused variables), and foundbuild.warningsis wider than expected: it independently catchesrustdoc::broken_intra_doc_linksand clippy lints too, not just plain rustc build warnings.rustdoc::private_intra_doc_links/redundant_explicit_linkswarnings across 10 crates that would have newly failed therustdocCI job. Both thecoverageandrustdocjobs now opt out via a job-localCARGO_BUILD_WARNINGS: "allow"override, preserving their exact pre-migration enforcement scope (RUSTDOCFLAGS/clippy's own-D warningsCLI flag stay unchanged and untouched).CHANGELOG.mdupdated under[Unreleased] / Changed.Follow-up (not filed by this PR, suggested in the migration handoff): a doc-cleanup issue for the 37 pre-existing rustdoc warnings, which would let the
rustdocjob's override eventually be retired.Note: a proposed diff for
CLAUDE.md/.claude/rules/branching.mdpre-commit command lists (dropping the now-redundantRUSTFLAGS="-D warnings"prefix) was drafted during development but intentionally NOT applied in this PR — those are user-owned governance docs requiring separate explicit approval, out of scope for this change.Closes #5873
Test plan
cargo build -vfingerprint comparison (Freshonbuild.warningstoggle vs. real recompile onRUSTFLAGStoggle).cargo/config.tomlvalidated safe re:Swatinem/rust-cachefingerprinting (no hash-key side effect)fy lint .github/workflows/ci.yml— 0 errorsfull,postgres,full,sqlite,bench) — all pass cleanlycoverage/rustdocjob overrides verified to restore exact pre-migration enforcement scope