Repository navigation
docs(backend): five rustdoc errors in the collector the docs gate cannot see - #1042
Merged
nihalpasham merged 1 commit intoAug 19, 2026
Merged
Conversation
…not see
`cargo doc` without `--document-private-items` never renders a private item,
so it never checks the intra-doc links in a private item's documentation.
Every one of these five sites is on a private fn or method of
`DeviceCollector`, and all five are errors the moment that flag is on:
error: unresolved link to `kernel` collector.rs:727
error: unresolved link to `device` collector.rs:727
error: unresolved link to `fqdn` collector.rs:1942
error: unresolved link to `process_call_operand` collector.rs:2130
error: unresolved link to `collect` collector.rs:2269
The first two are not links at all: line 727 quotes a runtime panic message
that contains `#[kernel]` / `#[device]`, and rustdoc reads the brackets as
reference syntax. The message is a literal string, so it becomes one code
span and stops being parsed.
The other three name methods on the same `impl<'tcx> DeviceCollector<'tcx>`
block that the documented items live in, so they only need the `Self::`
prefix to resolve; `fqdn` also loses its `()` suffix, which rustdoc does not
accept on a method path. All three now resolve to the intended methods
(`fqdn` at :994, `collect` at :1031, `process_call_operand` at :1336) rather
than silently pointing nowhere.
This is part of the cleanup named in NVIDIA#1014's merge note. Four more of these
errors remain, in `llvm-export/src/export/ops.rs`,
`mir-importer/src/translator/rvalue.rs` and
`mir-lower/src/convert/ops/aggregate.rs`; all three files are under open
pull requests right now, so they are left for a follow-up rather than
raced. `--document-private-items` can join the docs gate once they land.
Verified: `RUSTDOCFLAGS="-D warnings" cargo doc --no-deps
--document-private-items` in `crates/rustc-codegen-cuda` reports the five
errors above on `main` and exits 0 with this change; the gate's own
invocation (without the flag) exits 0 both before and after.
Signed-off-by: Vyncint Ng <[email protected]>
Collaborator
|
nihalpasham
approved these changes
Aug 19, 2026
nihalpasham
pushed a commit
that referenced
this pull request
Aug 20, 2026
The docs gate runs `cargo doc` without `--document-private-items`, so it never renders a private item and never checks the intra-doc links in one. #1014 and #1042 cleaned `cuda-macros`, `mir-importer/statement.rs` and the codegen backend's collector; this is one of the four that were left: error: unresolved link to `classify_op` --> crates/llvm-export/src/export/ops.rs:55 `classify_op` is a `macro_rules!` defined further down the same file, at :138. A `macro_rules!` macro is in scope only textually after its definition unless it is exported, so no path resolves from a doc comment above it -- rustdoc says as much: "`macro_rules` named `classify_op` exists in this crate, but it is not in scope at this link's location". It becomes a plain code span, and since the sentence is one step of a four-step contract about this file, it gains "below" so the reference still points somewhere. Three of the four remain. One is `make_disjoint_slice_struct` in `mir-lower/src/convert/ops/aggregate.rs`, which needs only a `crate::convert::types::` prefix; the other two are `MirFieldAddrOp` and `MirArrayElementAddrOp` in `mir-importer/src/translator/rvalue.rs`. Both files are under open pull requests (#1062 and #1064 for the first, #1059 and #1062 for the second), so they are left rather than raced. `--document-private-items` can join the docs gate once they land. Verified: `RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --document-private-items -p llvm-export` reports one unresolved link on `main` and none with this change. The gate's own invocation passes before and after. fmt clean. Comment-only change. Signed-off-by: Vyncint Ng <[email protected]>
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.
cargo docwithout--document-private-itemsnever renders a private item, so it never checks the intra-doc links in a private item's documentation. All five of these sites are on a private fn or method ofDeviceCollector, and every one is an error the moment that flag is on:The first two are not links at all. Line 727 quotes a runtime panic message containing
#[kernel]/#[device], and rustdoc reads the brackets as reference syntax. The message is a literal string, so it becomes one code span and stops being parsed.The other three name methods on the same
impl<'tcx> DeviceCollector<'tcx>block the documented items live in, so they only need theSelf::prefix to resolve.fqdnalso loses its()suffix, which rustdoc does not accept on a method path. All three now resolve to the intended methods —fqdnat:994,collectat:1031,process_call_operandat:1336— rather than silently pointing nowhere.Scope
This is part of the cleanup named in #1014's merge note ("Leaving the CI flag off until the other crates' private-doc errors are cleaned is deliberate; that cleanup is a follow-up").
Four more of these errors remain, re-measured against
f1e62fe2:crates/llvm-export/src/export/ops.rs:55classify_op!crates/mir-importer/src/translator/rvalue.rs:4552MirFieldAddrOpcrates/mir-importer/src/translator/rvalue.rs:4556MirArrayElementAddrOpcrates/mir-lower/src/convert/ops/aggregate.rs:618make_disjoint_slice_structAll three of those files are under open pull requests right now, so they are left for a follow-up rather than raced.
--document-private-itemscan join the docs gate once they land; with this change the backend workspace is clean under it.Verification
RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --document-private-itemsincrates/rustc-codegen-cudareports exactly the five errors above onmain, and exits 0 with this change.cargo fmt --all --checkandcargo clippy --all-targets -- -D warningsclean in that workspace.Comment-only change; no code paths touched.