next.js
4084a0f4 - Enforce strict rustdoc (incl. private items) across the Rust workspace (#100768)

Commit
4 days ago
Enforce strict rustdoc (incl. private items) across the Rust workspace (#100768) ### What? Makes rustdoc warnings fail CI for the whole Rust workspace, including private items, and fixes every existing warning so the new check starts green. - New `scripts/check-rustdoc.sh` runs `RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --document-private-items`. - The existing `rustdoc check` job in `build_and_test.yml` now runs that script before `scripts/deploy-turbopack-docs.sh`. The public `next-*` docs build is unchanged. - Fixes the warnings across the workspace's Rust crates (turbo-tasks, turbo-tasks-backend, turbo-persistence, turbopack-*, next-core, next-api, next-napi-bindings, …). ### Why? The existing `rustdoc check` job only documented the public items of five `next-*` crates and didn't treat warnings as errors. Broken intra-doc links and other rustdoc warnings went unnoticed everywhere else. Running strict private-items docs over the whole workspace found about 60 of them. ### How? The Rust source changes are doc comments only. The only other doc edit is one link target in `singleton_pattern.md`. Nothing is silenced with `#[allow]`, and no imports or visibility changes were added for docs. Types of fix: - **Unresolved links**: point to the correct full path (`turbo_tasks::…`, `crate::…`, `Self::…`). Some links named renamed or moved items, for example `Effect::apply` → `CapturedEffect::apply` and `dec_in_flight` → `decrement_in_flight`. Those now point to the current item. - **Links to items rustdoc can't link to**: plain code text. These are test-only or feature-gated items, `doc(hidden)` items, private items in another crate, and a private trait rustdoc doesn't resolve. - **Ambiguous `crate::value`** (module and macro): `macro@crate::value`. - **Bare URLs**: wrapped in `<…>`. - **Unclosed HTML tags** from generics such as `Option<T>`: put in backticks. - **Redundant explicit link targets**: removed. The check runs with the workspace's default features on the CI target. It doesn't cover every feature or platform combination. ### Verification - `./scripts/check-rustdoc.sh && ./scripts/deploy-turbopack-docs.sh` (the exact CI step) passes locally. - `RUSTDOCFLAGS='-D warnings' cargo doc --workspace --no-deps` (public items) passes. - Negative check: a temporary broken intra-doc link made `scripts/check-rustdoc.sh` exit non-zero. - `cargo fmt --all --check` is clean. <!-- NEXT_JS_LLM --> <!-- fleet 4bbc2447-5ae3-4b88-9649-a6b5ff30491e --> --------- Co-authored-by: vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by: Tobias Koppers <1365881+sokra@users.noreply.github.com> Co-authored-by: Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com>
Author
Parents
Loading