Skip to content

ci: migrate lint-warning gate from RUSTFLAGS to build.warnings - #5891

Merged
bug-ops merged 1 commit into
mainfrom
feat/issue-5873/migrate-lint-warning-ci-gate
Jul 10, 2026
Merged

ci: migrate lint-warning gate from RUSTFLAGS to build.warnings#5891
bug-ops merged 1 commit into
mainfrom
feat/issue-5873/migrate-lint-warning-ci-gate

Conversation

@bug-ops

@bug-ops bug-ops commented Jul 10, 2026

Copy link
Copy Markdown
Owner

Summary

  • Replace the global RUSTFLAGS="-D warnings" CI env var with Cargo's native build.warnings = "deny" (new committed .cargo/config.toml), stabilized in Rust 1.97 (cargo PR feat(compile): Stabilize build.warnings rust-lang/cargo#16796). 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 — verified locally via cargo build -v fingerprint comparison.
  • Phase A verification (empirical, documented in .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 found build.warnings is wider than expected: it independently catches rustdoc::broken_intra_doc_links and clippy lints too, not just plain rustc build warnings.
  • That wider scope surfaced 37 pre-existing rustdoc::private_intra_doc_links/redundant_explicit_links warnings across 10 crates that would have newly failed the rustdoc CI 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 (RUSTDOCFLAGS/clippy's own -D warnings CLI flag stay unchanged and untouched).
  • CHANGELOG.md updated 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 rustdoc job's override eventually be retired.

Note: a proposed diff for CLAUDE.md/.claude/rules/branching.md pre-commit command lists (dropping the now-redundant RUSTFLAGS="-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

  • Phase A verification: warning-class coverage parity (unused import/dead code/unused variable) — 100% match, no gap
  • Cache-invalidation behavior confirmed via cargo build -v fingerprint comparison (Fresh on build.warnings toggle vs. real recompile on RUSTFLAGS toggle)
  • Rustdoc/clippy interaction empirically tested
  • .cargo/config.toml validated safe re: Swatinem/rust-cache fingerprinting (no hash-key side effect)
  • fy lint .github/workflows/ci.yml — 0 errors
  • Full-workspace validation builds under the new gate, matching every CI feature-matrix entry (lint-clippy/msrv set, full,postgres, full,sqlite, bench) — all pass cleanly
  • coverage/rustdoc job overrides verified to restore exact pre-migration enforcement scope
  • Independent reviewer re-verification of the override mechanism, job coverage, YAML validity, and spec resolution

@github-actions github-actions Bot added ci CI/CD configuration size/S Small PR (11-50 lines) documentation Improvements or additions to documentation labels Jul 10, 2026
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
bug-ops force-pushed the feat/issue-5873/migrate-lint-warning-ci-gate branch from 16b9b01 to 0bce0ba Compare July 10, 2026 17:58
@bug-ops
bug-ops enabled auto-merge (squash) July 10, 2026 17:58
@bug-ops
bug-ops merged commit 2616f7b into main Jul 10, 2026
43 checks passed
@bug-ops
bug-ops deleted the feat/issue-5873/migrate-lint-warning-ci-gate branch July 10, 2026 18:10
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci CI/CD configuration documentation Improvements or additions to documentation size/S Small PR (11-50 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

migrate lint-warning CI gate from RUSTFLAGS=-D warnings to cargo's build.warnings

1 participant