Fix docs.rs build (crate-root feature(doc_cfg)) + add docs.rs CI job#100
Merged
Conversation
The crate root lacked `#![cfg_attr(docsrs, feature(doc_cfg))]`, which the per-module `#[cfg_attr(docsrs, doc(cfg(...)))]` labels require. docs.rs builds on nightly with `--cfg docsrs`, so it failed with E0658 (`#[doc(cfg)]` is experimental) — while the stable `docs` CI job (no `--cfg docsrs`, labels inert) passed, hiding the breakage until publish. - Add the crate-root feature gate (docsrs-only; stable builds unaffected). - Add a `docsrs` CI job that builds the docs exactly as docs.rs does (nightly + `--cfg docsrs`, warnings denied) so the gap can't recur. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
docs.rs failed to build
compcol-0.6.4. Root cause + the CI gap that hid it, both fixed here.Root cause
Modules across the crate carry
#![cfg_attr(docsrs, doc(cfg(feature = "...")))]labels (so docs.rs shows which feature each item needs), but the crate root never enabled the nightlydoc_cfgfeature. docs.rs builds on nightly with--cfg docsrs, so every one of those labels errors:Why CI didn't catch it
Our existing
docsCI job runs on stable without--cfg docsrs. Under those conditions thecfg_attr(docsrs, …)labels are inert, so the build is clean — the failure only appears in the docs.rs environment. (Notablyfeature(doc_cfg)was never present —git log -Sconfirms — so docs.rs builds had been fragile; recent nightly enforces it strictly.)Fix
src/lib.rs: add#![cfg_attr(docsrs, feature(doc_cfg))]at the crate root — the standard companion to per-moduledoc(cfg(...)). It'sdocsrs-gated, so stable builds are completely unaffected (verified)..github/workflows/ci.yml: newdocsrsjob that builds the docs exactly as docs.rs does — nightly +--cfg docsrs, warnings denied — so this class of failure is caught before publishing, not after.Verification
RUSTDOCFLAGS="--cfg docsrs -D warnings" cargo +nightly doc --all-features --no-deps→ E0658 (many modules).Generated …/index.html, no errors/warnings).cargo doc --all-features→ still clean;cargo build --all-features→ unaffected.This needs a patch release (0.6.5) to unbreak docs.rs for the published crate.
🤖 Generated with Claude Code