Fix every broken intra-doc link, and gate cargo doc in CI - #381
Merged
Conversation
`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.
Contributor
There was a problem hiding this comment.
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
docsjob to CI that runsRUSTDOCFLAGS="-D warnings" cargo doc --no-depson 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.
This was referenced Aug 7, 2026
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.
RUSTDOCFLAGS="-D warnings" cargo doc --no-deps— a check any release has to pass — fails onmainwith 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:applyresolves declarations into FoldPlans"apply"TypeKind::to_syn, checked over the corpus)"apply_value_structs/apply_sum_returnsValueDecon] / [SumDecon] — the types an adapter actually hands overPrebindgen::expansions(does not exist)Decompositions::expansions] — how they really arrivestripped_syntax(pub(crate))stripped_key] — the accessor a consumer can reachTwo of these were saying something false to an outside reader.
Origin's "the syntax is sealed" section describedas_synas "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 sixpub(crate)accessors by name: it now states the closure and names only what stays open. AndTypeKey::name's docs cited a test function name, now "a correspondence this crate's tests pin".Links across a layering boundary — 12.
prebindgen-registrydocs referencedJniGenBuilder,PtrClassDecl,ClassDecl,PackageDecl,ConstDecl,ptr_class!— all inprebindgen-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'sConstDecl::…").Stale names — 22. These are the substantive find: the docs described an API that no longer exists.
Flat::source,Flat::itemsFlatBuilder::source,FlatBuilder::itemsTypeRef::syntaxTypeRef::spellRegistry::finish,Self::resolveRegistryBuilder::buildCbindgenBuilder::nameCbindgenBuilder::base_nameRegistry::crossings(private)RegistryBuilder::crossings(the public one)Prebindgen::declared_constsdeclared_consts— never a trait methodConvertSourceDecl::error/::withConvertSourceDecl::from_type/FunctionDecl::new_localLayering, found on the way.
prebindgen-registry's public docs namedJniGenBuilder,PtrClassDecl,PackageDeclandClassDecl— one adapter's types, documented in the language-agnostic layer beneath it. Reworded to "the adapter's". Anddeclared_consts's doc block was sitting onrequired_output_types, glued in front of that function's own doc; moved back to the function it describes.prebindgen-jni'sjnimodule doc opened with the internal file layout and itspub(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::Sourceresolved to the registry's ownprebindgenmodule (now::prebindgen::Source), andPrebindgen/TypeRefneeded qualifying in modules where they are not in scope. Two redundant explicit link targets and one broken link inperftest-flatcame along.New
docsCI jobRuns
RUSTDOCFLAGS=-D warnings cargo doc --no-depson 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 docclean across the whole workspace, examples includedclippy --all-targets --all-features -D warningsandfmt --checkcleanregen-check.shbyte-identicalSplit out of #378, which keeps the release plumbing.