Skip to content

docs(rustc-codegen-cuda): gate this workspace's rustdoc and fix its broken links - #725

Merged
nihalpasham merged 1 commit into
NVIDIA:mainfrom
vyncint:fix/docs-gate-codegen-workspace
Aug 10, 2026
Merged

nihalpasham merged 1 commit into
NVIDIA:mainfrom
vyncint:fix/docs-gate-codegen-workspace

Conversation

@vyncint

@vyncint vyncint commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Closes #724.

crates/rustc-codegen-cuda is its own [workspace] (rustc-private dylibs), so
the root cargo doc --workspace in docs.yml never reaches it. Every other gate
has a dedicated step for that crate — fmt, clippy, unit-tests — and docs
did not.

That gap hid four real errors. The gate's own command, run against that
workspace on main:

$ cd crates/rustc-codegen-cuda && RUSTDOCFLAGS="-D warnings" cargo doc --no-deps
error: unresolved link to `collector::should_collect_from_crate`
error: public documentation for `rustc_codegen_cuda` links to private item `collector`
error: public documentation for `rustc_codegen_cuda` links to private item `device_codegen`
error: unresolved link to `layout`
error: could not document `rustc_codegen_cuda`

What was wrong

  • collector and device_codegen are private (mod, not pub mod), so linking
    to them from public crate docs is rejected. Now named, not linked.
  • should_collect_from_crate is a private method on the private
    DeviceCollector<'tcx> — that path could never have resolved, so it reads as
    DeviceCollector::should_collect_from_crate in prose.
  • layout has never been a module in this crate. The "Module Structure" list
    documented a module that does not exist, while omitting generated_intrinsics
    and materialize. Corrected to the four that do exist.

Only documentation comments changed; no code.

Verified

$ cd crates/rustc-codegen-cuda && RUSTDOCFLAGS="-D warnings" cargo doc --no-deps
    Finished `dev` profile
exit 0

cargo fmt --check passes for both the root workspace and
crates/rustc-codegen-cuda. No GPU needed for any of this.

The new step mirrors the existing rustc-codegen-cuda steps in fmt.yml and
clippy.yml, so the gate cannot silently skip that workspace again.

…roken links

`crates/rustc-codegen-cuda` is its own [workspace], so the root
`cargo doc --workspace` in the docs gate never reaches it. fmt, clippy and
unit-tests each carry a dedicated step for that crate; docs did not, and four
broken intra-doc links in its crate-level documentation went unreported as a
result:

    error: unresolved link to `collector::should_collect_from_crate`
    error: public documentation for `rustc_codegen_cuda` links to private item `collector`
    error: public documentation for `rustc_codegen_cuda` links to private item `device_codegen`
    error: unresolved link to `layout`

`collector` and `device_codegen` are private modules, so a link to them from
public crate documentation is rejected, and `should_collect_from_crate` is a
private method on the private `DeviceCollector<'tcx>`, so that path could never
resolve. All three are now named rather than linked.

`layout` was never a module in this crate. The "Module Structure" list
documented it while omitting `generated_intrinsics` and `materialize`, so the
list is corrected to the four modules that exist.

Adding the workspace to the docs gate keeps it that way.
`RUSTDOCFLAGS="-D warnings" cargo doc --no-deps` now exits 0 there.

Closes NVIDIA#724

Signed-off-by: Vyncint Ng <[email protected]>
@nihalpasham nihalpasham added documentation Improvements or additions to documentation build-related Build scripts, toolchain discovery, or compilation setup codegen Device code-generation pipeline (Rust MIR to IR to PTX) labels Aug 10, 2026
@nihalpasham

Copy link
Copy Markdown
Collaborator

Verified all four broken links exist on main and that the new docs leg needs no CUDA toolkit. A faithful copy of the unit-tests mechanism, which is right.

Merging;

closes #724.

@nihalpasham
nihalpasham merged commit 8354ac2 into NVIDIA:main Aug 10, 2026
36 checks passed
nihalpasham added a commit that referenced this pull request Aug 12, 2026
* build(just): lint and document the codegen workspace, as CI does

`just check` claims to run CI's gates minus a named few, and two of its
recipes were narrower than the jobs they mirror. Both miss
`crates/rustc-codegen-cuda`, which carries its own `[workspace]` for the
rustc_private dylibs so `--workspace` from the root stops at that
boundary. The `test` recipe already handles that crate the same way; these
two never did.

  * clippy: CI lints three scopes -- root workspace, the codegen
    workspace, and once per example. The recipe ran only the first, and
    ran it as `--all-targets --lib --tests`, where the target-selection
    flags narrow what `--all-targets` would have covered and so skip bin
    and example targets CI lints -- `cuda-host/examples/` among them. Now
    `--workspace --all-targets`, matching CI, plus the codegen workspace.
  * doc-check: the docs gate builds this workspace's rustdoc separately
    under `-D warnings` too. That job is mine, from #725, and I did not
    add it here.

The per-example clippy pass stays CI-only, and `check`'s comment now says
so rather than implying clippy is covered in full: it is one clippy run per
example across 200-odd separate workspaces, which belongs in a CI job
rather than in a command someone waits on.

Verified: both widened recipes pass here -- `just clippy` clean across
both workspaces, `just doc-check` builds the codegen rustdoc
warning-free -- so this closes a coverage gap without landing new work.

Signed-off-by: Vyncint Ng <[email protected]>

* docs(just): state the real change: CI-spelling parity plus the codegen-workspace passes

Signed-off-by: nihalpasham <[email protected]>

---------

Signed-off-by: Vyncint Ng <[email protected]>
Signed-off-by: nihalpasham <[email protected]>
Co-authored-by: nihalpasham <[email protected]>
nihalpasham added a commit that referenced this pull request Aug 12, 2026
* build(just): lint and document the codegen workspace, as CI does

`just check` claims to run CI's gates minus a named few, and two of its
recipes were narrower than the jobs they mirror. Both miss
`crates/rustc-codegen-cuda`, which carries its own `[workspace]` for the
rustc_private dylibs so `--workspace` from the root stops at that
boundary. The `test` recipe already handles that crate the same way; these
two never did.

  * clippy: CI lints three scopes -- root workspace, the codegen
    workspace, and once per example. The recipe ran only the first, and
    ran it as `--all-targets --lib --tests`, where the target-selection
    flags narrow what `--all-targets` would have covered and so skip bin
    and example targets CI lints -- `cuda-host/examples/` among them. Now
    `--workspace --all-targets`, matching CI, plus the codegen workspace.
  * doc-check: the docs gate builds this workspace's rustdoc separately
    under `-D warnings` too. That job is mine, from #725, and I did not
    add it here.

The per-example clippy pass stays CI-only, and `check`'s comment now says
so rather than implying clippy is covered in full: it is one clippy run per
example across 200-odd separate workspaces, which belongs in a CI job
rather than in a command someone waits on.

Verified: both widened recipes pass here -- `just clippy` clean across
both workspaces, `just doc-check` builds the codegen rustdoc
warning-free -- so this closes a coverage gap without landing new work.

Signed-off-by: Vyncint Ng <[email protected]>

* ci: move the reserved-prefix guard into a script

naming-guard was the last CI gate with real logic and no script: a
50-line shell block inline in the workflow, so it could not be run before
pushing, could not be mutation-tested, and `just check` listed it as
CI-only for exactly that reason.

`scripts/check-reserved-prefixes.sh` is that block, moved verbatim in
behaviour -- same pattern, same canary self-test, same grep exit-status
handling, same two filters. The reasoning comes with it, and it is worth
keeping: it records why bare `cuda_oxide_` is deliberately not matched
(pliron attribute keys, rustc `--cfg` names, dlopen probe symbols and temp
directories live in that word-space and are not reserved link symbols),
why `codegen_v1` needs its own alternation arm, and why a search that
cannot run has to fail rather than report an empty result -- the ripgrep
incident, where `rg ... || true` turned "command not found" into a clean
result on every commit.

The workflow now calls the script, `check-guards` runs it, and `check`'s
CI-only list drops naming-guard.

One deliberate change: the script reports `error:` on stderr like its eight
siblings rather than emitting `::error::` annotations, so its output reads
the same locally and in CI. The step still fails and the message is still
in the log; the PR-annotation nicety is the cost.

Verified equivalent, not just similar: identical verdict to the inline
pipeline on this tree (no violations from either); an injected literal is
caught with file and line; a pure-comment mention is still allowed; and
`reserved-oxide-symbols` stays exempt with its 45 legitimate literals.
`just check-guards` green with nine guards.

Signed-off-by: Vyncint Ng <[email protected]>

---------

Signed-off-by: Vyncint Ng <[email protected]>
Co-authored-by: nihalpasham <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build-related Build scripts, toolchain discovery, or compilation setup codegen Device code-generation pipeline (Rust MIR to IR to PTX) documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs gate skips the rustc-codegen-cuda workspace, hiding four broken intra-doc links

2 participants