Skip to content

rustdoc's treatment of cross-crate ("imported") files is suboptimal. #70757

@eddyb

Description

@eddyb

@bjorn3 noted in #70025 (comment) that single files missing disables [src] links for the entire crate.
That's not ideal UX, we should render as many source files as we can possible load.


And there's also the paths rustdoc uses (see #70025 (comment)), e.g.:

If we use the CrateNum of the original source file and reuse the existing rustdoc logic to get the relative path of that file in that crate, I believe we can even support linking to the source correctly even when the absolute paths are not usable (e.g. /rustc/$hash/src/libstd/thread/local.rs when using thread_local! and the rust-src rustup component isn't installed)

Because the downstream crate uses an exported macro from the original crate, the rendered source file should always have been generated, so we should never really need to re-generate it.

cc @rust-lang/rustdoc @Aaron1011

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-cross-crate-reexportsArea: Documentation that has been re-exported from a different crateC-enhancementCategory: An issue proposing an enhancement or a PR with one.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions