You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Rustdoc doesn't show src button for many functions in the rustc docs #70025
warning: source code was requested to be rendered, but processing `/dep/src/lib.rs` had an error: "/dep/src/lib.rs": No such file or directory (os error 2)
and the [src] links don't exist.
If you want to repro with the rustc sources, set remap-debuginfo = true and compiler-docs = true in config.toml and build the rustc docs.
@Centril can you maybe take a look at why this is now broken?
I think it should, but not sure. We have a try build going and once that's done IIRC a command like rustup-toolchain-install-master 40f2b445cd1c6c4e72d663d23c6d1bef2c674ad4 -c rust-docs should work, I believe.
And that's all the affected crates! Each uses macros from other crates, which define something.
thread_local! stands out as being from the standard library. Sure enough:
thread_local!(pubstaticFOO:bool = false);
$ cargo doc
Documenting test-70025 v0.1.0 (/home/eddy/Projects/test-70025)
warning: source code was requested to be rendered, but processing `/rustc/76b11980ad416c3ad6143504c2277757ecacf9b5/src/libstd/thread/local.rs` had an error: "/rustc/76b11980ad416c3ad6143504c2277757ecacf9b5/src/libstd/thread/local.rs": No such file or directory (os error 2)
skipping rendering of source code
Finished dev [unoptimized + debuginfo] target(s) in 3.53s
Something rustdoc could be doing, though, is checking which CrateNum a file is imported from, and try to use that crate's doc URLs, or at the very least use a separate doc/src dir, e.g. instead of:
Activity
bjorn3 commentedon Mar 15, 2020
@rustbot modify labels:+C-bug +T-rustdoc
ehuss commentedon Mar 29, 2020
I have narrowed this down to #66364. There some interaction between remap-path-prefix and macros in a dependency.
Repro:
This emits a warning:
warning: source code was requested to be rendered, but processing `/dep/src/lib.rs` had an error: "/dep/src/lib.rs": No such file or directory (os error 2)and the
[src]links don't exist.If you want to repro with the rustc sources, set
remap-debuginfo = trueandcompiler-docs = trueinconfig.tomland build the rustc docs.@Centril can you maybe take a look at why this is now broken?
Centril commentedon Mar 30, 2020
For now, I'll cc @GuillaumeGomez @eddyb @petrochenkov who probably know more about this than I.
Centril commentedon Mar 31, 2020
Centril commentedon Mar 31, 2020
Also relevant:
rust/src/librustdoc/html/sources.rs
Lines 35 to 55 in 2113659
eddyb commentedon Mar 31, 2020
Hang on, but there should be no macros involved in the
impl@bjorn3 posted, how is #66364 relevant?bjorn3 commentedon Mar 31, 2020
That code sets
self.scx.include_sourcesto false when any file could not be read.eddyb commentedon Mar 31, 2020
Oh, that's just bad UX and should be fixed independently on not being able to load some file.
eddyb commentedon Apr 1, 2020
@Mark-Simulacrum Is there any way to use the
trybuild on #70642 to check if it fixes this issue?i.e. does it include any docs?
Mark-Simulacrum commentedon Apr 1, 2020
I think it should, but not sure. We have a try build going and once that's done IIRC a command like
rustup-toolchain-install-master 40f2b445cd1c6c4e72d663d23c6d1bef2c674ad4 -c rust-docsshould work, I believe.eddyb commentedon Apr 2, 2020
@Mark-Simulacrum Uh oh I can't get anything like https://doc.rust-lang.org/nightly/nightly-rustc even for regular
nightlyinrustup, and none ofalloc/core/proc_macro/std/testare affected.Also, since this seems to affect the whole crate, it's easier to spot at that level:
newtype_index!macro to define types:rustc_astrustc_hirrustc_middlerustc_mirrustc_mir_buildrustc_query_systemrustc_spanrustc_targetdeclare_lint_pass!to define types:rustc_lintdeclare_box_region_type!to define types:rustc_interfaceimpl_stable_hash_via_hash!to defineimpls:rustc_errorsrustc_sessionimplement_ty_decoder!to defineimpls:rustc_metadatathread_local!to definestatics:rustc_data_structuresrustdocAnd that's all the affected crates! Each uses macros from other crates, which define something.
thread_local!stands out as being from the standard library. Sure enough:But with #70642, it works:
However, I have no way to check the CI environment itself, so we'll have to wait for #70642 to land.
eddyb commentedon Apr 2, 2020
Something
rustdoccould be doing, though, is checking whichCrateNuma file is imported from, and try to use that crate's doc URLs, or at the very least use a separatedoc/srcdir, e.g. instead of:target/doc/src/test_70025/home/eddy/.rustup/toolchains/40f2b445cd1c6c4e72d663d23c6d1bef2c674ad4/lib/rustlib/src/rust/src/libstd/thread/local.rs.htmlit should probably have created:
target/doc/src/std/thread/local.rs.htmleddyb commentedon Apr 3, 2020
#70642 landed, let's see what happens in 14-15h from now.
eddyb commentedon Apr 4, 2020
And the source is back! So I'm closing this issue, and I've opened #70757 for the remaining items.