Skip to content

cargo doc with build-std should document the requested sysroot crates #16546

@PatchMixolydic

Description

@PatchMixolydic

Problem

I'm currently working on a project that uses a custom target spec, so I need to use build-std to build core, alloc, and compiler_builtins. Naturally, this means that my target doesn't have precompiled documentation for core and alloc, which breaks intra-doc links and hides which APIs are available on my target (including the elusive AtomicU128).

Proposed Solution

If the project is already using build-std (eg. in .cargo/config.toml), cargo doc should automatically build the documentation for the requested sysroot crates. This would require rust-src, but build-std already requires that anyway.

As a workaround for this issue, I've written a script that makes the appropriate calls to rustdoc for my project. It's hacky (it depends on the layout of the sysroot and uses the exact names of build artifacts, including hashes), but I hope it may prove useful in informing any implementation efforts.

Notes

@rustbot label +Z-build-std

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-triageStatus: This issue is waiting on initial triage.Z-build-stdNightly: build-std

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions