Skip to content

Fix every broken intra-doc link, and gate cargo doc in CI - #381

Merged
milyin merged 4 commits into
mainfrom
fix/intra-doc-links
Aug 7, 2026
Merged

Fix every broken intra-doc link, and gate cargo doc in CI#381
milyin merged 4 commits into
mainfrom
fix/intra-doc-links

Conversation

@milyin

@milyin milyin commented Aug 6, 2026

Copy link
Copy Markdown
Owner

RUSTDOCFLAGS="-D warnings" cargo doc --no-deps — a check any release has to pass — fails on main with 81 errors across four crates. Nothing in CI ran it, so the crate split's fallout accumulated unseen: links that resolved inside one crate now point at private items, or at names that moved out of reach entirely.

Docs only. No code, no generated output changes.

Three kinds, fixed three ways

Links to private items — 47. These are the interesting ones. De-linking them to code spans silences rustdoc but keeps the leak: public documentation was still naming apply, TypeKind::to_syn, emit_core_construct, apply_value_structs — functions a reader of the docs cannot call, look up, or verify. A code span is not less of a leak than a link, only less checkable. So each one became prose about the behaviour, or a link to the public API that does have the answer:

Was Now
"apply resolves declarations into FoldPlans" "resolution turns the declarations into FoldPlans"
"cross-checked … in apply" "…at resolution"
"the syntax is recoverable from the kind (TypeKind::to_syn, checked over the corpus)" "(checked, over the whole acceptance corpus, by rebuilding it)"
apply_value_structs / apply_sum_returns [ValueDecon] / [SumDecon] — the types an adapter actually hands over
Prebindgen::expansions (does not exist) [Decompositions::expansions] — how they really arrive
stripped_syntax (pub(crate)) [stripped_key] — the accessor a consumer can reach

Two of these were saying something false to an outside reader. Origin's "the syntax is sealed" section described as_syn as "the one way to get" a node — an external reader cannot get one at all; it now says the node is reachable only inside the crate. flat::emit's "what is closed" section listed six pub(crate) accessors by name: it now states the closure and names only what stays open. And TypeKey::name's docs cited a test function name, now "a correspondence this crate's tests pin".

Links across a layering boundary — 12. prebindgen-registry docs referenced JniGenBuilder, PtrClassDecl, ClassDecl, PackageDecl, ConstDecl, ptr_class! — all in prebindgen-jni, which depends on the registry. The link is impossible by construction, not merely missing. De-linked, with the prose reworded where it read as if the item were reachable (ty! / path! / expr! now say "an adapter's ConstDecl::…").

Stale names — 22. These are the substantive find: the docs described an API that no longer exists.

Doc said Actually
Flat::source, Flat::items FlatBuilder::source, FlatBuilder::items
TypeRef::syntax TypeRef::spell
Registry::finish, Self::resolve RegistryBuilder::build
CbindgenBuilder::name CbindgenBuilder::base_name
Registry::crossings (private) RegistryBuilder::crossings (the public one)
Prebindgen::declared_consts the JNI builder's own inherent declared_consts — never a trait method
ConvertSourceDecl::error / ::with ConvertSourceDecl::from_type / FunctionDecl::new_local

Layering, found on the way. prebindgen-registry's public docs named JniGenBuilder, PtrClassDecl, PackageDecl and ClassDecl — one adapter's types, documented in the language-agnostic layer beneath it. Reworded to "the adapter's". And declared_consts's doc block was sitting on required_output_types, glued in front of that function's own doc; moved back to the function it describes.

prebindgen-jni's jni module doc opened with the internal file layout and its pub(crate) use …::* convention — a note to maintainers, not documentation of an API. It is a // comment now.

Two links were module shadowing rather than renames: prebindgen::Source resolved to the registry's own prebindgen module (now ::prebindgen::Source), and Prebindgen / TypeRef needed qualifying in modules where they are not in scope. Two redundant explicit link targets and one broken link in perftest-flat came along.

New docs CI job

Runs RUSTDOCFLAGS=-D warnings cargo doc --no-deps on every PR. Stable only — rustdoc's lint set moves with the toolchain, so the MSRV leg would only disagree about which warnings exist. Without this the next 81 accumulate exactly the same way.

Verification

  • cargo doc clean across the whole workspace, examples included
  • 531 lib tests + 20 + 10 + doc tests, 0 failures
  • clippy --all-targets --all-features -D warnings and fmt --check clean
  • regen-check.sh byte-identical

Split out of #378, which keeps the release plumbing.

milyin added 3 commits August 6, 2026 18:00
`RUSTDOCFLAGS="-D warnings" cargo doc --no-deps` fails with 81 errors
across four crates. Nothing in CI ran it, so the crate split's fallout
accumulated unseen: links that resolved inside one crate now point at
private items or at names that moved out of reach entirely.

Three kinds, fixed three ways:

- **Links to private items** (47). De-linked to plain code spans. The
  prose still names the internal helper — `apply`, `TypeKind::to_syn`,
  `emit_core_construct` — without claiming a link rustdoc can't make.
- **Links across a layering boundary.** `prebindgen-registry` docs
  referenced `JniGenBuilder`, `PtrClassDecl`, `ConstDecl`, `ptr_class!` —
  all in `prebindgen-jni`, which depends on it, so the link is impossible
  by construction. De-linked likewise.
- **Stale names**, repointed at what exists: `Flat::{source,items}` →
  `FlatBuilder::*`, `TypeRef::syntax` → `TypeRef::spell`,
  `Registry::finish` / `Self::resolve` → `RegistryBuilder::build`,
  `CbindgenBuilder::name` → `::base_name`, `Registry::crossings` →
  `RegistryBuilder::crossings`, and `Prebindgen::declared_consts` →
  the JNI builder's own inherent `declared_consts`.

Plus the module-path cases: `prebindgen::Source` resolved to the
registry's own `prebindgen` module (now `::prebindgen::Source`), and
`Prebindgen` / `TypeRef` needed qualifying where they aren't in scope.

New `docs` CI job runs the check per PR, stable only — rustdoc's lint set
moves with the toolchain, so the MSRV leg would only disagree about which
warnings exist.

Docs only: 531 lib tests + 20 + 10 + doc tests pass, clippy and
fmt --check clean, regen-check byte-identical.
The previous commit de-linked 47 references to private items, which
silenced rustdoc but left the leak: public documentation was still
naming `apply`, `TypeKind::to_syn`, `emit_core_construct`,
`apply_value_structs` — functions a reader of the docs cannot call, look
up, or verify. A code span is not less of a leak than a link; it is only
less checkable.

So every one of them is now prose about the behaviour, and where the
public API does have an answer, a link to that:

- **The phase, not the function.** "`apply` resolves declarations into
  FoldPlans" → "resolution turns the declarations into FoldPlans";
  "cross-checked ... in `apply`" → "at resolution".
- **The property, not the prover.** "the syntax is recoverable from the
  kind (`TypeKind::to_syn`, checked over the corpus)" → "(checked, over
  the whole acceptance corpus, by rebuilding it)".
- **A public answer where one exists.** `apply_value_structs` /
  `apply_sum_returns` → [`ValueDecon`] / [`SumDecon`], the types an
  adapter actually hands over; `Prebindgen::expansions` (which does not
  exist) → [`Decompositions::expansions`], which is how they really
  arrive; `stripped_syntax` → [`stripped_key`], the accessor a consumer
  can reach.
- **`Origin`'s seal** described `as_syn` as "the one way to get" a node.
  An external reader cannot get one at all — the text now says the node
  is reachable only inside the crate.
- **`flat::emit`'s "what is closed"** listed six `pub(crate)` accessors
  by name. It now states the closure and names only what stays open.
- **A test name** (`key_name_accessors_match_the_syn_walks`) appeared in
  `TypeKey::name`'s docs; now "a correspondence this crate's tests pin".

Two things beyond the private-item leak, found on the way:

- `prebindgen-registry`'s docs named `JniGenBuilder`, `PtrClassDecl`,
  `PackageDecl` and `ClassDecl` — one adapter's types, in the
  language-agnostic layer beneath it. Reworded to "the adapter's".
- `declared_consts`'s doc block was sitting on `required_output_types`,
  glued in front of that function's own doc. Moved back.

`prebindgen-jni`'s `jni` module doc opened with the internal file layout
and its `pub(crate) use ...::*` convention — a note to maintainers, not
documentation of an API. It is a `//` comment now.

cargo doc -D warnings clean, 531 lib tests + 20 + 10 + doc tests pass,
clippy and fmt --check clean.
#378 landed the release plumbing, which put its `package` job where this
branch puts `docs`. Both are wanted: kept `docs` then `package`, and the
`docs` comment now names publish.yml, which exists on main as of that
merge.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates Rustdoc-facing documentation across the workspace to eliminate rustdoc -D warnings failures from broken intra-doc links introduced by the crate split, and adds a CI gate to prevent regressions.

Changes:

  • Fix/replace intra-doc links that pointed at private, out-of-scope, or renamed items (mostly by rewording or linking to the correct public API).
  • Correct stale doc references to API names that have changed (e.g., RegistryBuilder::build, FlatBuilder::source/items, TypeRef::spell).
  • Add a new docs job to CI that runs RUSTDOCFLAGS="-D warnings" cargo doc --no-deps on stable.

Reviewed changes

Copilot reviewed 29 out of 29 changed files in this pull request and generated no comments.

Show a summary per file
File Description
prebindgen-registry/src/write.rs Updates doc link from old Registry::finish reference to RegistryBuilder::build.
prebindgen-registry/src/unfold/plan.rs Replaces links to private helper functions with public types (ValueDecon, SumDecon) and removes a now-invalid registry link.
prebindgen-registry/src/unfold/error.rs Removes intra-doc link to a private resolution function from error docs.
prebindgen-registry/src/unfold.rs Rewords module/type docs to avoid linking to private/internal resolution functions and points to public Decompositions entry points.
prebindgen-registry/src/registry/scan.rs Rewords docs to avoid linking to internal storage details in public-facing documentation.
prebindgen-registry/src/registry/mod.rs Adjusts docs to avoid referencing internal/private symbols via links.
prebindgen-registry/src/registry/error.rs Qualifies Prebindgen::validate link to ensure correct rustdoc resolution.
prebindgen-registry/src/registry/declare.rs Updates docs to match the builder API (build, crossings) instead of stale names.
prebindgen-registry/src/prebindgen.rs Removes a doc link that no longer correctly reflects the public API surface.
prebindgen-registry/src/lib.rs Fixes doc link resolution by disambiguating ::prebindgen::Source and updates builder/crossings references.
prebindgen-registry/src/expand/error.rs Removes intra-doc link to an internal apply function from error docs.
prebindgen-registry/src/expand.rs Rewords documentation to remove links to private/internal resolution helpers and clarifies description of core construct usage.
prebindgen-registry/src/decl.rs Updates macro/docs references to renamed/relayered items and removes impossible cross-crate links.
prebindgen-jni/src/jni/trait_impl.rs Fixes/relocates doc comments so they describe the correct function and don’t link to private/internal helpers.
prebindgen-jni/src/jni/mod.rs Converts maintainer-oriented module layout docs from rustdoc (//!) to non-public // comments.
prebindgen-jni/src/jni/decl.rs Updates a doc link to point at the correct registry-layer API (FunctionDecl::new_local).
prebindgen-jni/src/jni/builder.rs Removes a broken/misresolved intra-doc link by relying on in-scope matching.
prebindgen-flat/src/flat/ty.rs Rewords docs to avoid linking to crate-private syntax accessors and to reflect spell/stripped_key terminology.
prebindgen-flat/src/flat/spell.rs Rewords docs to avoid referencing internal helpers via intra-doc links.
prebindgen-flat/src/flat/origin.rs Clarifies documentation about syntax visibility boundaries without linking to crate-private accessors.
prebindgen-flat/src/flat/mod.rs Updates module docs to match current builder APIs and avoids stale symbol references.
prebindgen-flat/src/flat/key.rs Updates normalization and naming docs; fixes intra-doc link target to super::TypeRef.
prebindgen-flat/src/flat/emit.rs Rewords “closed surface” docs to avoid enumerating crate-private accessor names.
prebindgen-flat/src/flat/element.rs Rewords docs to avoid linking to internal normalization/spelling helpers.
prebindgen-flat/src/flat/array_len.rs Rewords docs to avoid linking to internal lowering function names.
prebindgen-c/src/lib.rs Updates docs to reference CbindgenBuilder::base_name instead of stale name.
prebindgen-c/src/builder.rs Rewords docs to remove stale links/names and to clarify callback naming behavior.
examples/perftest-flat/src/ext.rs Fixes a broken intra-doc link by qualifying the target path.
.github/workflows/rust.yml Adds a stable-only docs CI job running RUSTDOCFLAGS=-D warnings cargo doc --no-deps.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

The new `docs` job earned its place on its first run: CI's rustdoc is
newer than the local toolchain (1.97.1 here) and rejects
`[`java.lang.ref.Cleaner`]` — a Java class name, in brackets, which
rustdoc has no choice but to read as an intra-doc link to a Rust item.
It is a code span now.

`[`::core::mem::MaybeUninit<mirror>`]` goes the same way: `mirror` is
prose standing in for the generated type, not a path any rustdoc can
resolve. It survives today only because generic arguments are not
checked — the same accident that kept the Cleaner link quiet until the
toolchain moved.
@milyin milyin closed this Aug 7, 2026
@milyin milyin reopened this Aug 7, 2026
@milyin
milyin merged commit 85bc91c into main Aug 7, 2026
13 of 24 checks passed
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.

2 participants