Repository navigation
docs(crates): promote item prose stranded below its own rustdoc block - #7613
Merged
Merged
Conversation
A census of all 224,455 comment lines in `crates/` found exactly one coherent, mechanically-fixable defect class: an item already carries a `///` block, and prose about that same item sits BETWEEN the block and the item as `//`. rustdoc stops at the first non-doc line, so that prose is invisible in the generated documentation while reading, in source, as though it were part of the doc. Measured population: 189 sites (183 carrying an upstream citation, 6 plain prose). Scoped to the published surface - test and bench targets and `#[cfg(test)]` items are excluded, since rustdoc emits nothing for them - the change is 164 lines across 50 files. The fix is a pure in-place `//` -> `///` rewrite. Nothing moves and no text changes after the marker, so every upstream citation keeps its file, line and quoted anchor byte-for-byte. Deliberately NOT touched: 505 citation runs and 279 prose runs sitting above items that have NO rustdoc at all. There the `//` is a legitimate implementation note, and promoting it would newly document the item - a per-site judgement call, not a mechanical move. Verification: - `cargo fmt --all -- --check` clean - `cargo check --workspace --all-features` clean - `cargo doc --workspace --no-deps` reports no diagnostic in any changed file; every diagnostic location is in a file absent from this diff - `cargo clippy --workspace --all-targets --all-features` reports zero doc lints; `doc_markdown` does not fire on the promoted citations - `tools/ci/citation_drift_audit.py --ratchet` -> `ratchet OK`, no crate above its baseline, which is the load-bearing check here: the gate filters on the word `upstream` plus a `file.c:line` regex and is syntax-agnostic, so the promotion preserves all 23,500+ citations
This was referenced Sep 1, 2026
…ve it
`fmt + clippy` failed with
error: doc list item without indentation
--> crates/core/src/version/report/renderer.rs:616:5
note: `-D clippy::doc-lazy-continuation` implied by `-D warnings`
The promoted `upstream:` line landed directly beneath the bullet list
that enumerates the JSON key mappings, so rustdoc reads it as a lazy
continuation of the final `"optional secluded-args"` item.
Clippy offers two remedies - indent the line into that item, or separate
it into its own paragraph. The blank line is the correct one: the line is
the function's upstream citation, not a property of the last bullet, and
the citation-drift tooling scans for these lines on their own. Indenting
would bury a whole-function citation inside one list entry.
Verified with `cargo clippy -p core --all-targets --no-deps`: clean with
the blank line, and removing it reproduces the diagnostic at
renderer.rs:616 verbatim. A scan of all 50 files this branch touches
found exactly one site with this shape, so no sibling occurrence is
hiding behind clippy's first-error stop.
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.
What
An item already carries a
///block, and prose about that same item sits between the block and the item as//:rustdoc stops at the first non-doc line, so that citation is invisible in the generated docs while reading, in source, as though it were part of the doc block.
crates/bandwidth/src/limiter/core/limiter.rseven ends its doc block with a bare///before the stranded// upstream: io.c:sleep_for_bwlimit().This promotes those runs to
///. Pure in-place//->///; nothing moves, no text changes after the marker.Scope, measured not estimated
A census of all 224,455 comment lines in
crates/classified them, then split the "//run directly above an item" population by shape:The bottom two rows are deliberately left alone: there the
//is a legitimate non-doc implementation note, and promoting it would newly document the item. That is a per-site judgement call, not a mechanical move.Restricting the top two rows to the published surface (rustdoc emits nothing for test/bench targets or
#[cfg(test)]items, so promoting there is churn with no reader) gives the 164 lines across 50 files in this diff.git diff --shortstatis164 insertions(+), 164 deletions(-)— confirming the pure in-place rewrite with no line movement.The check that matters here
154 of the 164 lines carry an upstream citation, so the binding question is whether the citation gate still sees them.
tools/ci/citation_drift_audit.py --ratchet->ratchet OK, no crate above its baseline. The gate filters on the wordupstreamplus a\b([a-z_0-9]+)\.c:(\d+)regex and is syntax-agnostic about the comment marker, so//->///preserves every one of the 23,500+ citations. That is measured, not assumed.Other verification
cargo fmt --all -- --check— cleancargo check --workspace --all-features— cleancargo doc --workspace --no-deps— every diagnostic location is in a file absent from this diff (core/src/lib.rs,rsync_io/src/lib.rs,core/.../module_list/types.rs,transfer/src/pipeline/receiver.rs), so all are inherited by constructioncargo clippy --workspace --all-targets --all-features— zero doc lints;doc_markdowndoes not fire on the promotedoptions.c:89-style citations, which was the real risk of turning these into rustdocNot in scope
Three defect classes I expected to find measured as ~zero, each refuted by sampling before acting:
for/if/while/match. Zero real.XSTATE_TODOxattr protocol state, the upstream-mirrored enum variant.ReadFile,WriteFile),CAP_SYS_NICE, criterion benchmark cell names, std types (FileExt).The tree is already in good shape on documentation: 22 of 25 crates carry both
#![deny(missing_docs)]and#![deny(rustdoc::broken_intra_doc_links)], and there are 146k rustdoc lines against 52k plain comment lines. The three crates lacking the doc lints (matching,test-support,windows-gnu-eh) are a real completeness gap but a separate change.