rustdoc's treatment of cross-crate ("imported") files is suboptimal. #70757
Description
@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