Skip to content

fix(docs): publish complete API reference on docs.rs#1000

Merged
dekobon merged 1 commit into
mainfrom
docs/docsrs-all-features
Jul 1, 2026
Merged

fix(docs): publish complete API reference on docs.rs#1000
dekobon merged 1 commit into
mainfrom
docs/docsrs-all-features

Conversation

@dekobon

@dekobon dekobon commented Jul 1, 2026

Copy link
Copy Markdown
Owner

What

Make docs.rs publish the complete API reference and link it
prominently from the book.

docs.rs was building with default features only. Since default = ["all-languages"] excludes vcs, the entire feature-gated vcs
module (change-history metrics, #328) was silently missing from the
published API reference — the reference itself is 100% documented
(missing_docs clean, CI-gated), but the published copy dropped a
whole public surface.

Changes

  • Cargo.toml — add [package.metadata.docs.rs] with
    all-features = true and rustdoc-args = ["--cfg", "docsrs"], so
    docs.rs documents every public surface including vcs.
  • src/lib.rs — gate feature(doc_cfg) on --cfg docsrs and add a
    doc(cfg(feature = "vcs-git")) badge on pub mod vcs, rendering a
    per-item "Available on crate feature vcs-git" note. The module doc
    also points users at the vcs umbrella feature. The docsrs cfg is
    inert on stable builds.
  • Makefile — add doc-check-docsrs to reproduce the docs.rs build
    locally on nightly (--cfg docsrs) for pre-release verification;
    skips cleanly when nightly is absent. Wired into .PHONY and
    make help.
  • big-code-analysis-book/src/README.md — add a prominent API
    reference callout on the landing page and clarify the existing "API
    docs" section. (An mdBook SUMMARY.md sidebar entry was tried first
    but mdBook 0.5.3 rejects external URLs as chapter entries.)
  • CHANGELOG.md### Fixed entry under [Unreleased].

Why the book was the wrong place for the reference

The request began as "add API documentation to the book." For the Rust
library API the book is the wrong home: rustdoc/docs.rs is canonical,
auto-generated, and already CI-gated — duplicating signatures into
Markdown guarantees drift. The book already deferred there. The real
defect was that docs.rs shipped an incomplete copy; this fixes that and
makes the link unmissable rather than duplicating the reference.

Validation

  • make pre-commit — pass.
  • make doc-check-docsrs (nightly, --cfg docsrs, -D warnings) —
    clean; badge renders and the vcs surface is exercised.
  • Stable make doc-check and cargo clippy --all-features -- -D warnings — clean (docsrs is a well-known cfg in cargo 1.95, so no
    unexpected_cfgs; badges stay inert off docs.rs).
  • No metric computation touched — no snapshot drift.

docs.rs built with default features only, so the feature-gated `vcs`
module (change-history metrics, #328) was silently missing from the
published API reference. Add a `[package.metadata.docs.rs]` section
(`all-features = true`, `--cfg docsrs`) so every public surface is
documented, and gate `feature(doc_cfg)` on `--cfg docsrs` to render
per-item "Available on crate feature ..." badges.

Add a `make doc-check-docsrs` target to reproduce the docs.rs build
locally on nightly for pre-release verification, and make the book's
landing page link the docs.rs reference prominently so it is
unmissable.
@dekobon dekobon merged commit f939e8c into main Jul 1, 2026
44 checks passed
@dekobon dekobon deleted the docs/docsrs-all-features branch July 1, 2026 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant